a4-http-authorization-interceptor
Angular 7 Http Authorization Interceptor
How-To
Install
npm install a4-http-authorization-interceptor
app.module.ts
- Add
HttpAuthorizationModule
to imports of theapp.module.ts
.
...;...
Inject the service
constructorprivate httpAuthorizationService: HttpAuthorizationService
Set the token's cookie name
this.httpAuthorizationService.setTokenCookieName'oauth-cookie';
Set Authroization Header Call Back
this.httpAuthorizationService.setHttpAuthorizationCallback;
Get Authorization Header
;
This will return Bearer <token>
if cookie is found, otherwise it returns an empty string ('').