Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
token = this.auth.getToken() // auth is provided via constructor.
if (token) {
// Logged in. Add Bearer token.
return next.handle(
req.clone({
headers: req.headers.append('Authorization', 'Bearer ' + token)
})
);
}
// Not logged in. Continue without modification.
return next.handle(req);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.