You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm developing an app, using vite frontend with express and ExpressAuth as the backend.
I'm using vite's proxy option (in the vite.config.ts file to forward api and auth requests to the express backend on port 3002.
When I navigate to:
localhost:5173/auth/signout
And click ok - it navigates to:
localhost:3002 <-- the port for the backend
Instead of to localhost:5173 that I wanted.
I tried setting the AUTH_URL in the .env file - but:
a. It was ignored
b. it gave the following warning in the code: [auth][warn][env-url-basepath-redundant] Read more: https://warnings.authjs.dev#env-url-basepath-redundant
How to reproduce
Clone the repo
npm i
Open two terminals
3.1. run npm run dev in the first
3.2 run 'npm run dev-node' in the second
navigate to the url http://localhost:5173/auth/signout
Click sign out
it'll take you to localhost:3002 and not 5173
Try setting the AUTH_URL in the .env
it'll give the following warning in the console: [auth][warn][env-url-basepath-redundant] Read more: https://warnings.authjs.dev#env-url-basepath-redundant
even when basePath wasn't set
Expected behavior
Best result - will go back to the localhost:5173 without any configuration.
I can live with setting the AUTH_URL in the .env file - but that it'll be used
The text was updated successfully, but these errors were encountered:
noam-honig
added
bug
Something isn't working
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
labels
Sep 21, 2024
I think what you want to set is the callbackUrl option, not the AUTH_URL env var. You'll have to allow it to redirect the the front end in the redirect callback in your config, or set callbackUrl to a route in the backend whose handler redirects you to the front end.
It auto sets the basePath from the route so you shouldn't need to set it. The setEnvDefaults function will ignore the AUTH_URL if baseUrl is already set.
Environment
Reproduction URL
https://github.com/noam-honig/demo-auth-problem-with-proxy
Describe the issue
I'm developing an app, using vite frontend with express and ExpressAuth as the backend.
I'm using vite's
proxy
option (in thevite.config.ts
file to forward api and auth requests to the express backend on port 3002.When I navigate to:
localhost:5173/auth/signout
And click ok - it navigates to:
localhost:3002 <-- the port for the backend
Instead of to localhost:5173 that I wanted.
I tried setting the AUTH_URL in the .env file - but:
a. It was ignored
b. it gave the following warning in the code: [auth][warn][env-url-basepath-redundant] Read more: https://warnings.authjs.dev#env-url-basepath-redundant
How to reproduce
3.1. run
npm run dev
in the first3.2 run 'npm run dev-node' in the second
http://localhost:5173/auth/signout
it'll take you to localhost:3002 and not 5173
Try setting the AUTH_URL in the .env
it'll give the following warning in the console:
[auth][warn][env-url-basepath-redundant] Read more: https://warnings.authjs.dev#env-url-basepath-redundant
even when basePath wasn't set
Expected behavior
The text was updated successfully, but these errors were encountered: