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 on server #356

Open
franzwarning opened this issue Apr 22, 2024 · 1 comment
Open

Refresh token on server #356

franzwarning opened this issue Apr 22, 2024 · 1 comment
Labels
question Further information is requested

Comments

@franzwarning
Copy link

Quick question -- I'm making api calls on the server which require the supabase access token. My question is: is the token automatically refreshed on the server? Or just the client? I had to add this in my middleware/auth to get it to work (note, just using useSupabaseSession()) wasn't actually refreshing the token.

export default defineNuxtRouteMiddleware(async (to, _from) => {
    const client = useSupabaseClient()

    const session = await client.auth.getSession()

    if (!session.data.session) {
        return navigateTo(
            Urls.SignIn({ redirectAfter: encodeURIComponent(to.fullPath) })
        )
    }
})
@franzwarning franzwarning added the question Further information is requested label Apr 22, 2024
@franzwarning
Copy link
Author

Could we potentially add an argument to useSupabaseSession which awaits on refresh token (if necessary)

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

No branches or pull requests

1 participant