#Successful Auth callback is redirecting to localhost

13 messages · Page 1 of 1 (latest)

sick night
#

After successful login, the callback redirects to localhost. I have checked the env variables for redirect multiple times and also updated handleAuth on the call back multiple times but I do not know why or how to update or assign the correct Location field to the call back.

I have read previously in the Redirect to Localhost that this is an issue with some form of config or some form of monkey patching but I'm not too sure what the next step forward into fixing this issue would be.

Thank you!

exotic topazBOT
#

Project ID: 8425b175-2f24-462a-aa98-2ad6fec6c43b

sick night
#

Project ID: 8425b175-2f24-462a-aa98-2ad6fec6c43b

thin jungle
#

hosts like vercel would monkeypatch the location header for you, Railway wont, as Railway will only ever run your code as-is.

meaning you would need to set the correct redirect URL yourself in your own code or config.

sick night
#

Where can I access the config? In the Config-as-code section?

thin jungle
#

this would not have anything to do with railway itself, this is a change your need to make in your code or config

sick night
#

I don't quite understand, it seems to be taking the path of where the application was deployed on the vps, localhost:8080

#

I'm assuming i would have to change this deployment uri or some how telling the deployment to point to the railway domain?

thin jungle
#

yes you would need to tell your code the correct public url its running on so it can be used in the location header

#

again, nothing specific to the platform, please research how to do this with a nextjs app

sick night
#

Thank you!

sick night
#

Resolved this issue, the fix was adding a check in callback/routes.ts to see if the callback auth contains localhost or not, if it does contain localhost, force redirect to application domain 👍

thin jungle
#

awesome, glad you were able to fix!