Closed StiviiK closed 5 years ago
Hi @StiviiK, could you elaborate on this part But i want that my backend-token is stored in localStorage like with E-Mail/Password without wrapping into an NbOAuth2Token.
please?
Also, have you tried the NbAuthOAuth2JWTToken
token?
could you elaborate on this part
Yeah sure, it was a bit incomprehensive, so with E-Mail strategy my LocalStorage looks like this:
as value is the correct JWT Token, provided by my backend.
For Example in my JWTTokenInterceptor
i can intercept my token in any request like this:
Or as another example my JWTRoleProvider:
But when using OAauth the hole code breaks as my LocalStorage entry looks like this:
And this breaks, at first my code from above but also when I adjust my code the type-saftey from Typescript breaks as i have to interpret the Token as any
or as a own class because i need the methods.
Also, have you tried the NbAuthOAuth2JWTToken token?
Same result.
And btw. I'm using akveo/ngx-admin
in case this matters anyhow.
With Email strategy the jwt token gets correctly decocded:
With OAuth2 strategy its broken:
This isn't a problem of nebular, i just have understod OAuth2 wrong. So i'll close this.
Hey there, i have a problem on how to implement properly the authentication flow with OAuth2.
E-Mail/Password flow
->
http://API_URL/login
->
NbAuthJWTToken
, this token been generated by the backend generated and is required for all api calls)->
->
done.Wanted OAuth2 flow (similar to E-Mail/Password)
->
->
->
http://API_URL/oauth/login
->
->
->
done.My Problem currently are the points 1-5 working as expected, my backend gets called with
{ grant_type: 'authorization_code', code: '...', client_id: '...' }
which is perfectly fine, i'll repsond with folowing json{ data: { token: "BACKEND JWT TOKEN" } }
(which works perfectly fine with E-Mail/Password)and NebularAuth wraps this respond into an
NbOAuth2Token
, where the payload is the response from the Backend. But i want that my backend-token is stored in localStorage like with E-Mail/Password without wrapping into anNbOAuth2Token
.This is how my Strategy is implemented:
I hope you can understand my Problem. Thanks.