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 trying to implement multi-tenants authentication on subdomains via google / github. As I can't add every tenant on google / github whitelist, I thought of using the redirectProxy ( example from the Securing Preview Guide ) with the main domain, where the auth is located ( http://localhost:3000 for local dev) . However, I'm getting this error when trying a google signin from a subdomain ( let's say http://subdomain1.localhost:3000 ):
set up env variables: AUTH_GOOGLE_ID and AUTH_GOOGLE_SECRET
set up hosts file on your machine to include a subdomain: 127.0.0.1 subdomain.localhost
go to http://subdomain.localhost:3000/auth/login
try login via google
Expected behavior
I thought that this will create a proxy where the user from a subdomain doesn't really interact with the main domain's interface, instead, nextauth will handle this server side and redirect back to the subdomain to check for the state and pcke cookies. Or at least, send those cookies together to main domain.
The text was updated successfully, but these errors were encountered:
Dragosp33
added
bug
Something isn't working
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
labels
Nov 12, 2024
Environment
Reproduction URL
https://github.com/Dragosp33/aws-auth-test/tree/main
Describe the issue
I'm trying to implement multi-tenants authentication on subdomains via google / github. As I can't add every tenant on google / github whitelist, I thought of using the redirectProxy ( example from the Securing Preview Guide ) with the main domain, where the auth is located (
http://localhost:3000
for local dev) . However, I'm getting this error when trying a google signin from a subdomain ( let's sayhttp://subdomain1.localhost:3000
):The
pcke_code
andstate
cookies are added to the subdomain (http://subdomain1.localhost:3000
) and then I'm redirected to the main domain.auth.config.ts:
auth.ts:
middleware.ts:
.env:
How to reproduce
git clone https://github.com/Dragosp33/aws-auth-test/tree/main
AUTH_GOOGLE_ID
andAUTH_GOOGLE_SECRET
127.0.0.1 subdomain.localhost
http://subdomain.localhost:3000/auth/login
Expected behavior
I thought that this will create a proxy where the user from a subdomain doesn't really interact with the main domain's interface, instead, nextauth will handle this server side and redirect back to the subdomain to check for the
state
andpcke
cookies. Or at least, send those cookies together to main domain.The text was updated successfully, but these errors were encountered: