Working locally, but not on the prod server (maybe some domains issue) #1504
Unanswered
Vetlin
asked this question in
Support Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using auth next with laravel sanctum provider to communicate with laravel api. On my local I have nuxt app on port 3000 and laravel app on port 8000, so the urls are http://localhost:8000 and http://localhost:3000 💬
Also I have prod server set like this
Nuxt - http://maindomain.com
Laravel Api - http://api.maindomain.com
Here is my nuxt.config.js file
export default {
// Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
ssr: false,
}
Here is my login logic on login page
export default {
name: "login",
data: () => ({
email: '',
password: '',
}),
methods: {
async login() {
await this.$auth.loginWith('laravelSanctum', {
data: {
email: this.email,
password: this.password,
},
})
this.$router.push('/admin')
},
},
}
Admin page is under auth middleware.
So the problem is that on my local auth happens successfully, but when I try to login on prod server - nothing happens. In network I see that backend returned successful response, but I'm still on login page. I debug it a little bit, I log to console the state of this.$auth.user after login but before redirect, and on local it is returning user object as expected, but on prod - false.
So what can be the issue here? Is it related to the laravel api subdomain?
Beta Was this translation helpful? Give feedback.
All reactions