moinulmoin / chadnext

ChadNext - Quick Starter Template for your Next project includes Next.js 14 App router, Shadcn UI, LuciaAuth, Prisma, Server Actions, Stripe, Internationalization and more.
https://chadnext.moinulmoin.com
MIT License
895 stars 85 forks source link

how do you setup auth using github? #191

Closed sunny0183 closed 6 months ago

sunny0183 commented 6 months ago

I have managed to setup magic email using resend successfully

But have failed to setup github auth. the steps i followed is -

  1. create new app in github applications
  2. set homepage url - http://localhost:3000
  3. set auth callback url - http://localhost:3000/en/login/github/callback
  4. copied the client id and client secret to .env

after successful auth at github, the page gets redirected to -

http://localhost:3000/en/login/github/callback/?code=c13e63cd12fe3973b334&state=uHZqHiVHe60Cr-CI2NXx9zRxugQJq6lOW77BhdM384Y

this page then throws 404 error, page not found. i followed lucia guide which states the redirect url should be the above url but clearly it is not.

what should be redirect url for you app?

sunny0183 commented 6 months ago

found the answer to my question

http://localhost:3000/api/auth/login/github/callback

graham-fleming commented 6 months ago

Also @sunny0183 GitHub may not return the user email address until you set the permissions on the GitHub app for it.

Stripe needs the user email to work.

chiragksharma commented 3 months ago

found the answer to my question

http://localhost:3000/api/auth/login/github/callback

did you set this as the redirect uri??