Discord OAUTH not working, I've tried almost everything

When I try to sign in with discord it gives me the "Try signing in with a different account" error. I double checked my redirect link and it matches up. Database is pushed to the production branch, my NEXTAUTH_URL is set correctly in my environment variables. Discord id and secret all set correctly. I've retried all this multiple times and i've also reployed. Nothing is working.
10 Replies
Panda
Panda2y ago
What does your redirect link look like?
blues
bluesOP2y ago
@Panda it looks like my vercel link then /api/auth/callback/discord https://redacted-iota.vercel.app/api/auth/callback/discord (not the actual link)
Panda
Panda2y ago
Hmm well only other thing I can come up with is that you maybe have an account with a different provider in the database that has the same email as the discord one
blues
bluesOP2y ago
it works perfect for the development side, that being the redirect and everything and thats definitely not the case bc the email for my discord is the oldest email i have that has no ties with anything I have to OAUTHs in my discord one for production one for development, the redirect link technically works for production but when i click authorize it says try another account?
Panda
Panda2y ago
in your vercel env vars you don't need nextauth_url, can you try deleting that? and you have nextauth_secret i'm guessing
blues
bluesOP2y ago
I have the secret yes, i'm gonna try deleting url rn still same try signing in with a different account error just had a friend try to sign in and isn't working is it an issue on my discord application oauth side then? the client id and the discord secret are both correct
Panda
Panda2y ago
Honestly if I were you I'd just go through the whole process again, theres great youtube tutorials which you can just follow step by step
blues
bluesOP2y ago
I might try deleting the discord applications and remake them starting with the production one not the development i might also delete the deployment and reinstate the project on vercel if all fails idk what to do, i hope its not a database issue @Panda I figured it out... I used the wrong db URL, the URL i was using had the password as asterisks * , had to regenerate the url with a new password... I appreciate the help
Panda
Panda2y ago
Glad you figured it out buddy
𝖋𝖔𝖈𝖚𝖘
For me, it was returning this Error from Prisma:
The table `main.Session` does not exist in the current database.
The table `main.Session` does not exist in the current database.
It seems that the Session model is defined in your Prisma schema but the corresponding table has not been created in your SQLite database. To resolve this issue, you can follow these steps: 1. Run Migrations: Ensure that your database schema is up to date with your Prisma schema. You can do this by running the following command:
npx prisma migrate dev --name init
npx prisma migrate dev --name init
This command will create the necessary tables in your database based on your Prisma schema. 2. Push Schema Changes: If you are not using migrations and just want to push the current schema to the database, you can use:
npx prisma db push
npx prisma db push
3. Check Database Connection: Ensure that your DATABASE_URL in the .env file is correctly pointing to your SQLite database. 4. Prisma Studio: You can also use Prisma Studio to visually inspect your database and confirm that the Session table has been created:
npx prisma studio
npx prisma studio
After performing these steps, the Session table should exist in your database, and the error should be resolved.
Want results from more Discord servers?
Add your server