nuxt-auth icon indicating copy to clipboard operation
nuxt-auth copied to clipboard

Issue with adding origin

Open SherifAugustus opened this issue 3 years ago • 7 comments

Environment

Reproduction

n/a

Describe the bug

I still get the AUTH_NO_ORIGIN production error whenever I try to deploy my application even when I add my origin to the auth object in the nuxt.config.ts file

Additional context

The documentation I followed: https://sidebase.io/nuxt-auth/configuration/nuxt-config

Logs

AUTH_NO_ORIGIN: No origin - this is an error in production, see https://sidebase.io/nuxt-auth/resources/errors. You can ignore this during development

SherifAugustus avatar Aug 16 '23 14:08 SherifAugustus

I encountered the same issue. The error seems to be resolved by configuring the AUTH_ORIGIN environment variable. According to the specification outlined in this link, nuxt-auth attempts to determine the application's origin in the following manner:

  1. It checks for the presence of the AUTH_ORIGIN environment variable and utilizes it if set.
  2. Alternatively, it considers the auth: { origin: 'https://your-cool-origin.com' } configuration value from the nuxt.config.ts file if provided.

However, I've noticed that step 2 doesn't appear to function as expected.

dhondtlaurens avatar Aug 23 '23 13:08 dhondtlaurens

Yeah, auth settings in the nuxt.config.ts are not honored.

ahudovich avatar Sep 07 '23 08:09 ahudovich

Any news on this?

Saganic avatar Sep 30 '23 09:09 Saganic

auth.origin must be auth.baseURL, seems like the docs haven't been updated...

ahudovich avatar Oct 16 '23 10:10 ahudovich

auth.origin must be auth.baseURL, seems like the docs haven't been updated...

This is a change done in v0.6 and upwards. You can find the correct documentation for this when selecting the correct version from the module headers.

https://sidebase.io/nuxt-auth/v0.6/configuration/nuxt-config

As this seems to be a misunderstanding, I will close this issue and refer you to the documentation or to #368 if there are any issues with deploying to another baseUrl.

zoey-kaiser avatar Oct 17 '23 08:10 zoey-kaiser

To resolve the AUTH_NO_ORIGIN error in your Nuxt.js project, you need to ensure that your environment variable is correctly set and properly used in your Nuxt configuration. Here are the steps to fix this issue:

First, set the AUTH_ORIGIN environment variable in your .env file. For example:

.env

AUTH_ORIGIN=http://localhost:3000

2.Configure Nuxt to Use the Environment Variable:

In your nuxt.config.ts file, ensure that the auth module uses the AUTH_ORIGIN environment variable. Here is how you can do it:

    auth: {
    baseURL: process.env.AUTH_ORIGIN
   }

FerhatCengz avatar May 16 '24 23:05 FerhatCengz

As of 0.6.7 it needs to be auth: { baseURL: process.env.AUTH_ORIGIN + "/api/auth" }

otherwise it will thrown an error No match found for location with path "/session"

fyyyyy avatar Apr 01 '25 19:04 fyyyyy