New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Local Provider : baseURL not considered after deployment #368
Comments
and here is the pm2 config on my web server :
|
Any idea ? |
IT works only if the baseUrl is hardcoded like that in nuxt.config.ts :
|
I'm currently encountering the same issue in my OAuth flow. My config: auth: {
origin: process.env.AUTH_ORIGIN,
basePath: '/api/auth',
defaultProvider: 'foobar',
enableGlobalAppMiddleware: false,
}, I've checked that the This is the OAuth flow observed from the Devtools:
I have no idea why the redirect response includes a callbck URL to |
Yeah, we do deduce some stuff automatically - but in 0.6 this is a bit broken at the moment, sorry for that - the beta is not quite stable. I don't have super much time at the moment but will try to resolve this ASAP! |
@kaboume as a workaround you could try setting the |
thanks @romanzipp It's better but I'v still an issue. Now the Call Api made by SignIn meythod is https://dev.api.website.org/api/auth/auth/login in the place of https://dev.api.website.org/auth/login So Nuxt Auth added /ai/auth When I display the config :
|
having the same issue |
I had the same issue but i was able to fix it by adding: computed: {
origin: true,
fullBaseUrl: process.env.AUTH_URL,
}, to auth:{} |
Sorry, can I know where did you add this code? I mean changing from
to
|
@BracketJohn : is this issue fixed with the 0.6.0-beta.3 release ? |
i added the whole computed object inside the auth object like this:
|
Good morning, |
Hi @kaboume, We have been pretty swampped over the summer with other projects, which is why our focus sadly had to shift away from sidebase for a while. I am currently rammping up my work on the project again and have this on my list of hotfixes, to look into! |
Hello @kaboume @romanzipp 👋 I did some testing myself on version 0.6.0-beta.7. I can report the following:
Which did take my new route into account. Therefore, I conclude that in my Dev setup the According to the code, this should also be the case, as we take the given My follow up questions to properly determine your issues:
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@sidebase/nuxt-auth'],
devServer: {
port: 3001
},
auth: {
baseURL: 'http://localhost:3001/api/users',
provider: {
type: 'authjs'
},
globalAppMiddleware: {
isEnabled: true
}
}
}) |
Hi @zoey-kaiser Here is my configuration:
My frontend calls my nodeJs backend to authenticate users with a login/password. |
Hi @kaboume, Could you be so kind to tell me a bit about your deployment? Is it only a normal webserver where you then start the application or are you using Vercel, Netlify etc. |
Closed due to inactivity. If you still require more help, please comment in this issue and we can reopen it! |
This issue still persists and not even after deployment, but locally too. This is my auth: {
baseURL: process.env.NUXT_PUBLIC_API_BASE || "http://localhost:3333",
provider: {
type: "local",
endpoints: {
signIn: { path: "/login", method: "post" },
signOut: { path: "/logout", method: "post" },
signUp: { path: "/register", method: "post" },
getSession: { path: "/session", method: "get" },
},
pages: {
login: "/auth/login",
},
token: { signInResponseTokenPointer: "/accessToken" },
sessionDataType: {},
},
enableSessionRefreshPeriodically: 5000,
enableSessionRefreshOnWindowFocus: true,
globalMiddlewareOptions: {
allow404WithoutAuth: true, // Defines if the 404 page will be accessible while unauthenticated
addDefaultCallbackUrl: "/", // Where authenticated user will be redirected to by default
},
}, Using |
Found out that these lines are probably the fault here https://github.com/sidebase/nuxt-auth/blob/main/src/module.ts#L111-L113 And |
Glad I found this issue and scrolled down. I wanted to report this issue aswell. I documented this in my config like so:
So I think this might be related, although it probably is because of this line: Line 122 in 5d713aa
|
Thanks for finding this. I am not sure if this is a bug, to me it looks like an intended feature because of the default Line 111 in 5d713aa
Modifying this will be a hard breaking change for our users who already use no trailing slash at the end. We already use |
True, it is breaking change. I see that. But it should not append |
Environment
Reproduction
No response
Describe the bug
Good morning,
I use the "Local" Provider without any problem on my laptop with an API back-end on http://localhost:8080
But when I deploy my app on my Web server, the baseUrl parameter does not seem to be taken into account.
Here is my conf:
.env (laptop)
nuxt.config.ts:
When I display the contents of the conf variable I have this:
On my Laptop :
on the web server :
However the NUXT_PUBLIC_URL_API constant is well loaded by Nuxt as shown by the public / urlApi variable of the Nuxt config
And suddenly, as the baseUrl variable is not configured, when I call signIn, the http post call is made on:
instead of :
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: