Successful Auth callback is redirecting to localhost
omomuro
TRIALOP

a year ago

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!

11 Replies

omomuro
TRIALOP

a year ago

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


brody
EMPLOYEE

a year ago

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.


omomuro
TRIALOP

a year ago

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


brody
EMPLOYEE

a year ago

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


omomuro
TRIALOP

a year ago

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

1279465831654228200


omomuro
TRIALOP

a year ago

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


brody
EMPLOYEE

a year ago

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


brody
EMPLOYEE

a year ago

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


omomuro
TRIALOP

a year ago

Thank you!


omomuro
TRIALOP

a year ago

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 👍


brody
EMPLOYEE

a year ago

awesome, glad you were able to fix!


Loading...