Next.js Discord

Discord Forum

(SUPABASE NEXTJS 13) Error AuthApiError: invalid flow state, no valid flow state found

Unanswered
lucas posted this in #help-forum
Open in Discord
Avatar
lucasOP
Hi good afternoon, I am having problems while using nextjs 13 and supabase for authentication more specifically the provider I am using is the one from github, I have all the settings that are required in the documentation and I don't know what can be the problem.


- error AuthApiError: invalid flow state, no valid flow state found
at handleError (webpack-internal:///(rsc)/./node_modules/.pnpm/@supabase+gotrue-js@2.48.1/node_modules/@supabase/gotrue-js/dist/main/lib/fetch.js:36:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async _handleRequest (webpack-internal:///(rsc)/./node_modules/.pnpm/@supabase+gotrue-js@2.48.1/node_modules/@supabase/gotrue-js/dist/main/lib/fetch.js:84:9)
at async _request (webpack-internal:///(rsc)/./node_modules/.pnpm/@supabase+gotrue-js@2.48.1/node_modules/@supabase/gotrue-js/dist/main/lib/fetch.js:63:18)
at async SupabaseAuthClient._exchangeCodeForSession (webpack-internal:///(rsc)/./node_modules/.pnpm/@supabase+gotrue-js@2.48.1/node_modules/@supabase/gotrue-js/dist/main/GoTrueClient.js:377:33)
at async eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@supabase+gotrue-js@2.48.1/node_modules/@supabase/gotrue-js/dist/main/GoTrueClient.js:784:28) {
__isAuthError: true,
status: 403
}
Image

5 Replies

Avatar
lucasOP
My component to run the authentication
Image
And my route
Image
Avatar
Spectacled bear
Hello @lucas . Have you found a reason? I also have this issue, but only the first time I start the project. After that it works
Avatar
lucasOP
Hi @Spectacled bear the only solution I found was to capture the session from the cookies (server side) and redirect to the login in case I don't have basically what the middleware does, I did it in the design therefore it is inherited
Avatar
Spectacled bear
Thank you!