Code Monkey home page Code Monkey logo

Comments (28)

fangmarks avatar fangmarks commented on August 26, 2024 1

Could you two share your two env entiries I showed above, here?

from stub.

ggtylerr avatar ggtylerr commented on August 26, 2024 1

Trying to use this app and hit the same roadblocks @NViviers is having. Unfortunately setting it as a different port (or really any port) makes Discord / GH not accept the Callback URI (although that might be because I'm running it over a domain and not localhost.)

Additionally, emails don't seem to send. I'm using a poste.io setup and I believe that since it allows multiple domains the SMTP URI doesn't work at all. But that's a nodemailer / next-auth.js issue and I don't think much can be done about it sadly.

On a (somewhat) related note, why are logins required? Shouldn't the user be allowed to use it without an account? It's a link shortener.

from stub.

Snazzah avatar Snazzah commented on August 26, 2024

Not sure how this isn't working, but I've mainly used Discord OAuth in development. Email has worked on instances before, just don't know why it doesn't work locally.

from stub.

NViviers avatar NViviers commented on August 26, 2024

Now that I've gotten Discord auth working, I'm able to say for sure that the other auth methods have the same problem. They all seem to do the login process but then send me back to the login page

from stub.

Snazzah avatar Snazzah commented on August 26, 2024

Huh weird, I've tested e-mail and Discord in my own environment and they work fine. What environment are you testing this on?

from stub.

fangmarks avatar fangmarks commented on August 26, 2024

on my setup i have the admin panel on admin.lio.tld and the actual shortener on lio.tld and everything has been working fine for me

Do you have the Callback URL for NextAuth set to your Admin Panel?
These are mine and it works fine
image

edit:

I mainly use Email Login, but recently added Github Login as well, and both of those are working as they should

from stub.

Codeize avatar Codeize commented on August 26, 2024

I'm also facing this issue, even with different OAuth providers (Discord and GitHub), the same happens.

from stub.

Codeize avatar Codeize commented on August 26, 2024

Could you two share your two env entiries I showed above, here?

Sure, they are the same as provided by default, however.

# The callback URL for authentication purposes (ex. "https://example.com")
NEXTAUTH_URL=http://localhost:3000

# The domain of the app
APP_HOSTNAME=localhost:3000

from stub.

Snazzah avatar Snazzah commented on August 26, 2024

Did you guys fill in the NEXTAUTH_SECRET? That would also impact authentication.

Also @himbolion the APP_HOSTNAME should've been the same domain as the admin instance (which is redundant from NEXTAUTH_URL but whatever) It's a little important since that domain gets assigned when using cookies.

from stub.

NViviers avatar NViviers commented on August 26, 2024

I've got the exact same entries as Codeize, I have filled in NEXTAUTH_SECRET through the link provided in the line above that entry.

from stub.

Codeize avatar Codeize commented on August 26, 2024

I've got the exact same entries as Codeize, I have filled in NEXTAUTH_SECRET through the link provided in the line above that entry.

Same here, I did what was asked of me in the example env file.

from stub.

NViviers avatar NViviers commented on August 26, 2024

Huh weird, I've tested e-mail and Discord in my own environment and they work fine. What environment are you testing this on?

Seems I never answered this. I'm running Pop!_OS here with Docker 20.10.20 and I'm visiting the project in Firefox

from stub.

NViviers avatar NViviers commented on August 26, 2024

I can try running this on Windows as well as Ubuntu, although Ubuntu will be running ARM instead of x86

from stub.

fangmarks avatar fangmarks commented on August 26, 2024

Weird, it's been running well for me on my Debian Server through Docker, with all those entries filled as well.

Are you using the latest Docker Image, if running through docker?
Or are you using the latest version of the Repo if you've just cloned the Repo?

from stub.

NViviers avatar NViviers commented on August 26, 2024

Yes, I am running the latest Docker image provided. I have also tried a fresh install of it, fresh .env file with all the entries filled in.

from stub.

Snazzah avatar Snazzah commented on August 26, 2024

Well the only thing I can think of is if there were errors while next-auth was handling authentication. Maybe the redirect URI was mistyped when using the Discord OAuth. Does the query string of the login URL change at all? Maybe something like error=LoginFailed or something. You can also inspect the requests from your browser and see if that leads to anything.

from stub.

NViviers avatar NViviers commented on August 26, 2024

I've triple checked the OAuth redirect URI, it's definitely correct. The query string doesn't change. localhost:3000 sends me to localhost:3000/login, after logging in through Discord I get sent back to exactly localhost:3000/login again.

There are no errors in the console, the network tab doesn't show anything weird either.

from stub.

Snazzah avatar Snazzah commented on August 26, 2024

Huh, I guess browser settings could impact it? I don't even know, I have the same environment variables and it works fine over localhost and on a separate server.

from stub.

NViviers avatar NViviers commented on August 26, 2024

I've tried on both Firefox and Chrome, both have the same result. Simply send me back to the login page

from stub.

NViviers avatar NViviers commented on August 26, 2024

Huh, I guess browser settings could impact it? I don't even know, I have the same environment variables and it works fine over localhost and on a separate server.

Are you able to send us your .env file? I want to compare to see what difference there is, we're running through docker so there shouldn't be any problems there. I've tried both Chrome and Firefox (Don't think the problem is there either)

from stub.

fangmarks avatar fangmarks commented on August 26, 2024

I can grab mine in a bit, since I recently moved servers and it still works fine for me on the new server

from stub.

JackBailey avatar JackBailey commented on August 26, 2024

Same issue here

Using docker compose on Ubuntu 20, didn't change anything but env variables. Tried with both magic link (didn't receive email) and github (redirected back to login)

from stub.

fangmarks avatar fangmarks commented on August 26, 2024

My env looks like this
image

my compose.yml looks like this
image

my secrets are censored , for obvious reasons. But this has been working fine on my old and now my new server

from stub.

NViviers avatar NViviers commented on August 26, 2024

This might a stupid question, but in the logs I see both ports 3000 and 3001 open, I'm visiting localhost:3000/login for the login, I've tried with Discord authentication to redirect to both localhost:3000/api/auth/callback/discord and localhost:3001, the first one gives me a Invalid OAuth2 redirect_uri : You can now close this tab. error message from Discord (Without it redirecting me or anything yet), the second actually redirects me to http://localhost:3001/api/auth/callback/discord?code=...&state=... and displays Not Found. Am I using this incorrectly?

from stub.

Snazzah avatar Snazzah commented on August 26, 2024

Yeah, that's the problem, the redirect URI port needs to be at 3000 since that's where the admin panel is at. You need to add localhost:3000/api/auth/callback/discord as a redirect URI in your Discord app page for Discord OAuth to function.

from stub.

NViviers avatar NViviers commented on August 26, 2024

Yeah, that's the problem, the redirect URI port needs to be at 3000 since that's where the admin panel is at. You need to add localhost:3000/api/auth/callback/discord as a redirect URI in your Discord app page for Discord OAuth to function.

I've tried both, I was just asking to see which one it should be. Now that I tested again, after confirming it to be set to http://localhost:3000/api/auth/callback/discord it's still doing the same thing

from stub.

vdeville avatar vdeville commented on August 26, 2024

Hello,
Do you solve your problem ? Because i have exactly the same issue.
After click on the link received by mail, i will redirect to /login again and again.

I set super-admin from cli after i installed the yarn package for dev, but no change.

/app $ yarn manage set-superadmin
yarn run v1.22.19
$ tsx scripts/cli.ts set-superadmin
Enter the email of the user you want to set as a superadmin.
โœ” E-mail ยท [email protected]
Updating superadmin user ... OK
Done in 6.72s.

Do you have any idea to solve the problem ?

Thanks

from stub.

vdeville avatar vdeville commented on August 26, 2024

Same issue with the Github OAuth, redirect to /login again and again.
Thanks @Snazzah

from stub.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.