Has anyone successfully gotten authentication to work on subdomains with nextAuth/Auth.js? #320
Replies: 6 comments
-
Looking for a similar solution for a SaaS product, where app.domain.com acts as the SaaS provider and every tenant is a customer. |
Beta Was this translation helpful? Give feedback.
-
Is there any updates? |
Beta Was this translation helpful? Give feedback.
-
Have tried a bunch of ways unsuccessfully. From what I can tell OAuth is virtually impossible because you can't give a dynamic callback URL value to the OAuth provider (Google, GutHub, etc). You might be able to do credentials or email magic link. I'm thinking it has to be an entirely separate instance of NextAuth if you go that route. Or, roll your own solution. |
Beta Was this translation helpful? Give feedback.
-
Any movement in this direction? |
Beta Was this translation helpful? Give feedback.
-
Really curious about how this is done! I've got a use case for this as well |
Beta Was this translation helpful? Give feedback.
-
Any updates on this, this is exactly what I'm looking for to setup a SaaS similar to above. Each of my users has their own sub domain unique_id.domain.com where a private community needs to be hosted with it's own authentication |
Beta Was this translation helpful? Give feedback.
-
Let's say you have:
app.domain.com
example1.domain.com
example2.domain.com
example3.domain.com
The current starter kit makes the app.domain.com secure but when creating the sites example1, example2, example3, they are publicly accessible. Is it possible to add authentication to the example sites to make them secure as well?
For context, I'm trying to make a website builder where admins log in on app.domain.com and they can create websites that each have their own users. Users would log in on the example1.domain.com and only be able to access the contents of that site according to the database information.
I've searched quite a bit through forums and poured over documentation. I cannot seem to get the auth session to be shared across subdomains via the cookie. Any help is appreciated!
Beta Was this translation helpful? Give feedback.
All reactions