Please let us allow to provide JWT_OPTIONS so that we can use DI for our tokenGetter
See original GitHub issueHow am I supposed to use services in token getter. It was possible in previous version of this module but this newer version does not allow to do that. If we are allowed to provide config
option as provider then this is doable. I was expecting to do following so that I could utilize services to provide token.
export function jwtOptionsProvider(store) {
return {
tokenGetter() {
let token;
store.select('authToken').select(1).subscribe(t => token = t);
return token;
};
}
}
[
{
provide: JWT_OPTIONS,
useFactory: jwtOptionsProvider,
deps: [Store]
}
]
Angular v 4.3.1 auth0/angular-jwt v^1.0.0-beta.5
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to pass dependencies to @auth0-angular-jwt?
This can be done by overriding config service: export const jwtOptionsFactory = (dependency) => ({ tokenGetter: () => dependency.
Read more >Structuring token based authorisation in an Angular web app
In this article, I will talk about how you might structure your own Angular Web app to make use of this feature for...
Read more >ASP.NET Core Authentication with JWT and Angular - Part 2
We are going to use the @auth0/angular-jwt library, to help us with JWT validation and with adding the token to the HTTP requests....
Read more >JWT Authentication with ASP.NET Core 2 Web API, Angular 5 ...
With this role stashed in our token, we can use a claims-based authorization check to give the role access to certain controllers and...
Read more >@auth0/angular-jwt - npm
If you have multiple tokens for multiple domains, you can use the HttpRequest passed to the tokenGetter function to get the correct token ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The
tokenGetter
is currently set up to handle a returned string value synchronously, however, support for async token fetching is coming 👍@chenkie Great, just in time, thanks for the notification.