You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// TODO: see if we can figure out localhost + port dynamically from the nuxt instance
61
-
if(process.env.NODE_ENV==='production'){
62
-
logger.error('You must provide `origin` for production. The origin is the scheme, host and port of your target deployment, e.g., `https://example.org` (port ist 80 implicitly)')
63
-
thrownewError('Bad production config - please set `auth.origin`')
64
-
}else{
65
-
usedOrigin='http://localhost:3000'
66
-
logger.warn(`\`origin\` not set - an origin is mandatory for production. Using "${usedOrigin}" as a fallback`)
logger.info(`Using "${url}" as the auth API location, make sure the \`[...].ts\` auth-handler is added there. Use the \`auth.orign\` and \`auth.basePath\` config keys to change the API location`)
72
+
logger.info(`Using \`${url}\` as the auth API location, make sure the \`[...].ts\` file with the \`export default NuxtAuthHandler({ ... })\` is added there. Use the \`nuxt.config.ts\` \`auth.origin\` and \`auth.basePath\` config keys to change the API location`)
73
+
if(process.env.NODE_ENV==='production'){
74
+
logger.info('When building for production ensure to (1) set the application origin using `auth.origin` inside your `nuxt.config.ts` and (2) set the secret inside the `NuxtAuthHandler({ secret: ... })`')
console.warn('nuxt-auth runtime: No secret supplied - supplying a secret will be necessary for production')
61
-
if(process.env.NODE_ENV==='production'){
62
-
thrownewError('Bad production config - please set `secret` inside the `nuxtAuthOptions`')
62
+
console.warn('nuxt-auth runtime: No `secret` supplied - supplying a `secret` will be necessary for production. Set the `secret` in the `NuxtAuthHandler` like so: `NuxtAuthHandler({ secret: "your-production-secret" })`')
63
+
if(isProduction){
64
+
thrownewError('Bad production config - set `secret` inside the `NuxtAuthHandler` like so: `NuxtAuthHandler({ secret: "your-production-secret" })`')
63
65
}else{
64
66
usedSecret='secret'
65
67
}
66
68
}
67
69
70
+
if(!useRuntimeConfig().auth.isOriginSet){
71
+
// eslint-disable-next-line no-console
72
+
console.warn('nuxt-auth runtime: No `origin` supplied - supplying an `origin` will be necessary for production. Set the `origin` in your `nuxt.config.ts` like so: `auth: { origin: "https://your-origin.com" }`')
73
+
if(isProduction){
74
+
thrownewError('Bad production config - set the application `origin` inside your `nuxt.config.ts` file like so: `auth: { origin: "https://your-cool-website.com" }` ')
0 commit comments