Skip to content
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

Status of refreshing tokens #690

Closed
eatrocks opened this issue Sep 18, 2020 · 7 comments
Closed

Status of refreshing tokens #690

eatrocks opened this issue Sep 18, 2020 · 7 comments
Labels
question Ask how to do something or how something works

Comments

@eatrocks
Copy link

What is the status of adding the ability to refresh tokens to the next-auth library?

We use OAuth in a two-party authentication scenario. The application and the IDP are under our control. Therefore, that third-party of Facebook, Twitter, Google, and Apple for example, are never involved. We are using the token expiration and token refresh features of OAuth to drive the length of the users' session with the application. Therefore tokens expire relatively quickly (minutes and hours, not weeks/months/indefinitely). Therefore we need our apps to be able to refresh the tokens. We wouldn't use next-auth with a database; only with JWT's enabled.

Besides reading the docs, looking at some of your source, and having next-auth up and running in a test application I have read through these related to token refreshing...

@eatrocks eatrocks added the question Ask how to do something or how something works label Sep 18, 2020
@eatrocks
Copy link
Author

eatrocks commented Sep 21, 2020

I am willing to help with this token refresh feature. I have helped write and maintain a non-public library for Next.js with an Express.js custom server using a single, internal IDP in the situation I described above.

@geraldnolan
Copy link
Contributor

@iaincollins I keep coming back to check status as well. Everything is working great with the library minus the refresh token piece. I am not a huge fan of using the JWT callback. (It was refreshing the token way too much). It's also not updating the secure cookie.

@eatrocks which IDP are you using? I am a little hesitant to post the workaround here until @iaincollins comments.

@eatrocks
Copy link
Author

@geraldnolan I'm interested in your workaround. Are you willing to share it? Seems like @iaincollins is busy lately, and that's understandable considering this is an open source project that is contributed to with spare time.
I also found out that I may not be able to submit a PR for the token refresh feature without approval from my management and likely the legal department :( which will likely be a slow process with questionable outcome.

@elilambnz
Copy link

I understand that a robust solution is required to refresh tokens for all services, however I've provided a basic workaround for refreshing tokens when using the credentials provider and callbacks here.

I look forward to official support for refreshing tokens and any critiques to this approach are more than welcome!

@stale
Copy link

stale bot commented Jan 8, 2021

Hi there! It looks like this issue hasn't had any activity for a while. It will be closed if no further activity occurs. If you think your issue is still relevant, feel free to comment on it to keep it open. (Read more at #912) Thanks!

@stale stale bot added the stale Did not receive any activity for 60 days label Jan 8, 2021
@guido4000
Copy link

This has not been resolved.

@stale stale bot removed the stale Did not receive any activity for 60 days label Jan 8, 2021
@balazsorban44
Copy link
Member

balazsorban44 commented Feb 3, 2021

As the OP asks for only JWT token rotation, I am going to close this as there are user-land solutions for this.
My approach would be something similar to this:
#1079 (comment)

Until we have a built-in solution (for that #951 is the most up-to-date one), it has to be handled by the user.

Giving a solution that works for everyone (db and non-db, single and multiple provider users) and secure is hard, and we need all the time to give a good answer for this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Ask how to do something or how something works
Projects
None yet
Development

No branches or pull requests

5 participants