Auth not succesfull on subdomain route


I have succesfully integrated two subdomains on my adonis app. nama.local and When I the user is logged in. I can successfully use the auth variable to access all the auth properties of the logged in user on name.local domain name but for the domain name, all the auth properties return undefined. Plus the auth middleware returns invalid session error even when the user is logged in, on the same domain name. Any one that can help in solving this, I will appreciate. Thanks you


@virk can you help with this. I want to use one session accross mutlple sub domains i.e auth should work in foo.local and As things stand now, it is only working on foo.local


You will have to set the domain inside config/session.js file under the cookie options.

cookie: {
  httpOnly: true,
  domain: 'foo.local'


@virk thanks very much for your answer

cookie: {
httpOnly: true,
domain: ‘foo.local’,
sameSite: false,
path: ‘/’

it works for domain but not for foo.local. i.e session is not saved on the main domain which is foo.local but works for


How about is I have multiple domain names, can use objects instead of string


Can you share following.

  1. Is authentication done on or foo.local?
  2. The HTTP response header after user is logged in?


auth is done foo.local then redirects to accounts.fool.local


@virk @fredrickreuben

Did you ever find a way around this? I don’t imagine this will be an issue for PR, but Google SSO is not allowing subdomains as part of Authorized redirect domains.