azure active directory – Nuxt3 Nuxt-auth single-tenant configuration for Entra Id
Trying to setup @sidebase/nuxt-auth against our Entra ID for authentication. But keep getting the
AADSTS50194: Application 'app guid'(app name) is
not configured as a multi-tenant application. Usage of the /common endpoint is not
supported for such applications created after '10/15/2018'. Use a tenant-specific
endpoint or configure the application to be multi-tenant.
What is the correct setup for this configuration? This is what I’m using atm:
import { NuxtAuthHandler } from '#auth'
import AzureADProvider from "next-auth/providers/azure-ad";
const runtimeConfig = useRuntimeConfig()
export default NuxtAuthHandler({
pages: {
signIn: '/login'
},
secret: runtimeConfig.authSecret,
providers: [
AzureADProvider.default({
clientId: runtimeConfig.public.azureAdClientId,
clientSecret: runtimeConfig.AzureAdClientSecret,
tenantId: runtimeConfig.public.AzureAdTenantId,
authorization: {
url: `https://login.microsoftonline.com/${runtimeConfig.public.azureAdTenantId}/oauth2/v2.0/authorize`,
params: {
scope: "openid profile email",
}
},
token: {
url: `https://login.microsoftonline.com/${runtimeConfig.public.azureAdTenantId}/oauth2/v2.0/token`
},
}),
],
})
This is how the auth settings in nuxt.config.ts looks like:
auth: {
isEnabled: true,
globalAppMiddleware: true,
disableServerSideAuth: false,
originEnvKey: 'NUXT_AUTH_ORIGIN',
baseURL: 'http://localhost:3000/api/auth',
provider: {
type: 'authjs',
trustHost: false,
defaultProvider: 'azure-ad',
addDefaultCallbackUrl: true,
},
sessionRefresh: {
enablePeriodically: true,
enableOnWindowFocus: true,
}
},
Read more here: Source link

