supabase / auth-helpers

A collection of framework specific Auth utilities for working with Supabase.
https://supabase.github.io/auth-helpers/
MIT License
908 stars 233 forks source link

nextjs 13 / PKCE flow is not supported on signups with autoconfirm enabled #569

Closed bmichotte closed 1 year ago

bmichotte commented 1 year ago

Bug report

Describe the bug

Following the documentation for auth with nextjs13, I receive an error AuthApiError: PKCE flow is not supported on signups with autoconfirm enabled when I try to signup a user.

I tried both client and server action versions without success.

System information

Additional context

I'm currently working on a self-hosted version of supabase for the development.

silentworks commented 1 year ago

@piccinnigius it is adviced to not use a version locally that hasn't been deployed to the platform as yet. The current version that has been deployed to the platform is v2.92.1.

piccinnigius commented 1 year ago

@silentworks ok thanks so much for the advice πŸ™

jdgamble555 commented 1 year ago

@silentworks - A suggestion about closing threads. There are developer and user reasons to not close an issue until it is actually fixed, not with a work-around, which is what this is. Anyone who is using the latest local version of Supabase and trying to test an auth flow could come across this error and need to read this Github issue. Not only is your fix in the middle of this thread and hard to find, it will be under closed issues. It might be advantageous to keep this open for those people until the CLI update is pushed.

That being said, on a different note, I was getting this error when using the fix with supabase db reset:

When I use the "v2.92.1," I am getting the:

"Failed to load configuration: required key API_EXTERNAL_URL missing value"

Which is said to be fixed in the latest cli version: https://github.com/supabase/supabase/issues/16702

However, I can't use the latest CLI version, or I will not have this issue fixed. Perhaps I a missing something here.

Thanks,

J

silentworks commented 1 year ago

@jdgamble555 any reason why you can't use the latest CLI version? btw the issue you are having now isn't related to this thread, probably best to move it over to the CLI repo and tag me there.

You might be confusing what issue this thread is about when you say it hasn't been fixed. The original author of this issue said this wasn't working in self-hosted (not CLI) but this has been fixed in both hosted and self-hosted (since this is up to a user to manage and they can simply pull the docker container for the gotrue version with the fix mentioned).

The fix for anyone using the CLI is stated above in this comment https://github.com/supabase/auth-helpers/issues/569#issuecomment-1703159422

jdgamble555 commented 1 year ago

@silentworks - Well you need the CLI to install the docker, but this is a moot point now. Got it working by deleting all docker files and reinstalling (with the gotrue-version file intact).

Thanks for you help :)

My other point was just to not close this until the gotrue version is pushed as the default version on docker for the reasons I mentioned above.

J

jeremypeters commented 1 year ago

I've just hit the same issue as @jdgamble555. I've had to add v2.92.1 to the gotrue-version as the recommended workaround to prevent the PKCE error, but now I am also experiencing the same "Failed to load configuration: required key API_EXTERNAL_URL missing value" error using this version.

raulghm commented 1 year ago

Upgrading supabase package to last version resolve the issue in my case.

jdgamble555 commented 1 year ago

The latest cli version seems to have updated gotrue, so you don't need the workaround anymore.

J

rdewolff commented 1 year ago

I can confirm that updating my local supabase instance has fixed the issue πŸ•ΊπŸŽ‰

Simply stop and start the supabase instance, it has downloaded the last version and works.

supabase stop
supabase start

Thanks for everyone that took the time to investigate the issue and help solve it :)