PasswordFlow with Cookie-Storage does not work each time
See original GitHub issueHey,
first of all, thank you for your create work and my bad english 😃.
I tried different storage solutions but i need to use the cookie storage for login on different subdomains.
My Angular Version is 7 and had the same on 6.
Sometimes after calling the login with PasswordFlow:
fetchTokenUsingPasswordFlowAndLoadUserProfile(email, password) .then((user) => { // OK }) .catch((err) => { // ERROR });
i will get an error (but not in chrome, only in Safari or Firefox). As an cookie storage i used this one:
https://www.npmjs.com/package/cookie-storage
I checked what could be the problem. Login is successfull and the access_token is stored as an cookie but i think not fast enough.
After checking the code, i found one part that could be a problem:
storeAccessTokenResponse is called on token response but async. it resolves the token response but the caller in line 562 https://github.com/manfredsteyer/angular-oauth2-oidc/blob/0274cf5c03080e2a139abbf84d2bb9dd2480f3c2/projects/lib/src/oauth-service.ts#L562 doesnt work with the response and calls the
method wich checks the access token first.
if the browser or the storage is not fast enough, the access token check says that the token is not valid because it doesnt exists.
Is it possible to return the token response and work with it instead checking the storage?
Thanks
David
Issue Analytics
- State:
- Created 5 years ago
- Comments:7
Top GitHub Comments
Yes, your right. Thanks for your support.
What was the exact solution to this? Did you have to change something on your authentication service (specifically this ‘CookieStorage’ part by @davidk85), or did you do some magic within your Angular project?