Next.js Discord

Discord Forum

Problems with authentication using Supabase and Next.js

Unanswered
Saltwater Crocodile posted this in #help-forum
Open in Discord
Saltwater CrocodileOP
I'm trying to implement register and login functionality with supabase and their nextjs helpers package, so I'm using supabase.auth.signUp to register a new user, and supabase.auth.signIn to login, and I'm also trying to implement protected routes, so I don't want unauthenticated users be able to access /dashboard for instance otherwise they shall be redirected to /login, but my problem is that I can't get any of this working, specifically:

1. When I signup a user with a specific email and password, then I login back, I get an error from supabase that the credentials are incorrect.
2. When a user sign ups, I redirect them to /auth/callback where the code cookie is exchanged for a session, im not sure, but there's no code cookie that gets sent with the request, I only got that stuff working with oauth providers like github.

https://github.com/bwkam/opt
here's the full code, help is very appreciated as I've been trying to tackle that since yesterday but no luck and i"m not very good with backend stuff

2 Replies

Saltwater CrocodileOP
ok I found the first bug, the input fields weren't name'd
Saltwater CrocodileOP
forget all what I said, my main problem now is that supabase doesn't create a new session when a user has signed in with auth.signIn()