-
Notifications
You must be signed in to change notification settings - Fork 694
Code flow and automatic refresh token #722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As a thought, maybe #682 is related? |
try a different order for your setup sequence. I found a suggestion in another issue that worked for me. I use code flow and identityserver also for a demo and I can see the refresh happening in the console. However this version is still and Angular8 version though.
you can see the refresh token happening in the console for my demo once you login after a moment |
@jeroenheijmans
Odly, thebaron24's suggestion seems to work... spooky! |
Nice, good to hear you solved things, thanks for sharing! |
@jeroenheijmans |
Maybe @thebaron24 has some suggestions on that? We could re-open or open a fresh issue if the docs need brushing up, or if we know we should explicitly throw an error under some configuration circumstances.... |
I think conceptually it makes sense to set up the refresh flow before you get the discovery document and init the login flow. It looks like the majority of people were using this package in the implicit flow and as things are moving towards the code from with PKCE we are seeing some gaps in the documentation. I had a difficult time setting up a nodejs based server side rendering with universal also because the documentation pointed to an angular 5 version using .net as the server side tech. However, the source code viewer they have set up was what saved me: for example the auth service source and people who hover int he issues section are pretty helpful :) I think the only suggestion I have would be what you already said - update the documentation to reflect this order because anyone who used this would probably want to setup short term token refresh like this. |
Ah, that comments helps me see the actual issue 😅. In that case, in my flow I also set up the listener way before I run the initial login sequence with the disco document. |
your example was actually a huge help while setting up my project. |
With all due respect (to all the amazing hard work put in this project and the people who did it), I think a public API should only expose function members that are commutative. If a public method needs some previous state set by other method, then in my opinion the latter should call the previous. Nonetheless, I am still having some odd failures when renewing the token and the logging is definitely not correct "Error performing password flow" or in any case misleading. thank you all. |
@aznarepse Is it correct to assume that you suggest that calling
does that paraphrasing sound correct? If so, I think I'd agree, and I'd be tempted to open up a fresh issue for that (linked to this one) so we can focus on those improvements? |
@jeroenheijmans |
I have been banging my head against this for many hours now and would appreciate some direction.
The setup:
Config excerpt:
configure method:
Problem
Using code flow and not a problem to login with a user and to actually enforce the authorization both in client and back end by roles.
However, refreshing the token fails always and the behavior is 'strange' in my opinion.
The client tries refreshing with two different refresh tokens consecutively and I receive two responses (see debugging log):
The idtoken and the accesstoken are similar but the refresh is not. These request are sent one after the other (straight).
Then, I get two failures in a row:
Note the error 'Error performing password flow', which I am not sure is just a funny in the loging or it is actually trying a password flow... because IdentityServer4 is not complaining about the password flow but about the token not existing...
Which I believe it is in the db.
Finally, at some point, the client will not be able to access the back end with the error ' Token expired'
However, the client is still working fine with the user logged in. If I logout and login again, or simply send a login again (without actually logout), I will have access to the back end again since my new token is fresh.
Please, any advice or lead for me to be able to progress?
The text was updated successfully, but these errors were encountered: