Secure way to configure lucia when dealing with multiple apps running in different sub-domains #955
-
|
Hi! I am planning to have 3 apps running on a particular domain (i.e.
The nextJs app running on is the following configuration for sessionCookie: {
attributes: {
domain: 'myapp.com',
sameSite: 'strict',
}
},
csrfProtection: {
allowedSubdomains: ['auth', 'web', 'api']
}Is there any other configuration that I am missing in terms of security? thank you |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Setting Assuming Lucia will be initialized in csrfProtection: {
allowedSubdomains: ['web', 'api']
}
|
Beta Was this translation helpful? Give feedback.
-
|
thank you |
Beta Was this translation helpful? Give feedback.
Setting
SameSite: Strictmeans your users won't be logged in if they access your website via a link. That's fine for say banks, but I don't think that's what you want for the majority of websites.Assuming Lucia will be initialized in
auth.myapp.com, you can omitauthsince that's included by default.Domaincookie attribute should only be set if you're planning to read session cookies on the server onweb.myapp.comandapi.myapp.com.