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

Refresh token? #1

Open
osseonews opened this issue Jun 17, 2022 · 2 comments
Open

Refresh token? #1

osseonews opened this issue Jun 17, 2022 · 2 comments

Comments

@osseonews
Copy link

Thanks for this amazing tutorial. I'm just curious, as the access token from directus will expire in 15 minutes, so won't ever user just be logged out every 15 seconds from this app? Or is the refresh token handled automatically by nextauth or directus? If not, how do you handle refreshing the access token? THanks.

@devalade
Copy link

No, the refresh is there to renew the access_token every 15s
I didn't read through the code correctly, but you can use axios interceptor to handle refresh token
There is also apollo-refresh-token but I don't know handle that efficiently with React Query

Sugestion
you can create a function that with help you get the renew the token by passing the refresh_token
So you will verify error status in the [nextjsAuth...] file, if you get 401 error that means that the user is not authorize
then you fetch the token

@staminna
Copy link

Dear Ivandoric, What should go here?

const graphQLAPI = process.env.NEXT_PUBLIC_GRAPHQL I cannot signup with error

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (system, line 0)
HTTP://localhost:3000/undefined/system
[Error] Unhandled Promise Rejection: SyntaxError: The string did not match the expected pattern.
promiseEmptyOnRejected
promiseReactionJob

Is it possible to integrate the QR-Code and 6-digit one-time password into the template?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants