Successful Auth callback is redirecting to localhost
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!
Solution:Jump to solution
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 π
11 Replies
Project ID:
8425b175-2f24-462a-aa98-2ad6fec6c43b
Project ID: 8425b175-2f24-462a-aa98-2ad6fec6c43b
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.
Where can I access the config? In the Config-as-code section?
this would not have anything to do with railway itself, this is a change your need to make in your code or config
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?
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
Thank you!
Solution
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 π
awesome, glad you were able to fix!