I am using Next Auth with only 1 provider, Azure AD. Usually, Next-Auth with create a session token (__Secure-next-auth.session-token
) that I can send to my backend and decode for authentication.
Recently this token disappeared and in its place there are now two tokens:
__Secure-next-auth.session-token.0
__Secure-next-auth.session-token.1
Neither of these tokens are properly formatted JWTs that my backend can decode.
What are these new tokens and how can I get the old one back?
route.ts
import NextAuth from "next-auth"
import AzureADProvider from "next-auth/providers/azure-ad"
const providers = [
AzureADProvider({
clientId: process.env.AZURE_AD_CLIENT_ID || '',
clientSecret: process.env.AZURE_AD_CLIENT_SECRET || '',
tenantId: process.env.AZURE_AD_TENANT_ID,
}),
]
export const authOptions = {
providers: providers
}
const handler = NextAuth(authOptions)
export { handler as GET, handler as POST }