Closed radudiaconu0 closed 3 years ago
Same here! Nuxt auth for some reason tries to fetch user when I'm browsing the website as a guest 🤔
Here's my config:
Have a look at this might help you with the solution https://serversideup.net/using-laravel-airlock-with-nuxtjs/
same here...
Nuxt auth for some reason tries to fetch user when I'm browsing the website as a guest 🤔
I'm having the same issue as well. There has to be a better way to see if user is logged in on cookie flow that doesn't involve getting a 401 from the user endpoint. And with the user endpoint set to false, you're always logged in. Seems like getting the logged in status in general for the cookie flow is a little off.
same here ...
any solution ?
======
set user to false and get user manually
axios: {
baseURL: 'http://127.0.0.1:8000',
credentials : true
},
auth: {
strategies: {
local: {
endpoints: {
login: {
url: '/login',
method: 'post',
},
user: false
},
tokenRequired: false,
tokenType: false
}
}
},
Same issue here... Can this be even fixed?
Yeah, it seems pretty broken. Glad it's not just me. Disabling the feature altogether and grabbing that data manually seems like a viable workaround at least.
Closing here, as cookie scheme and laravel sanctum provider are now available in auth v5.
any update on this?
@GanchoDanailov @planetchili @pawel-marciniak @ryzexsp @brcpar @dloused @tiran133 @AndrewSavetchuk
Hey guys! This issue was already fixed :)
You should use cookie scheme, which depends on cookie instead of token. And if you are using laravel sanctum, then I recommend the laravel sanctum provider.
Both are available in auth v5. We now recommend using v5 instead of v4. See status and #893
WHen i use laravel airlock with nuxt js and auth module on every page i navigate i get 401 error without being authenticated. i put correct middleware on every route. why is that happen? when i login all things works properly.(i use spa mode but i am curious how can i make things works on unversal mode) this is my nuxt configuration:
axios: { baseURL: 'http://app.cheer.test/', withCredentials: true }, auth: { redirect: { login: '/login', logout: '/', callback: '/login', home: '/home' }, strategies: { local: { endpoints: { login: { url: 'login', method: 'post', withCredentials: true, headers: { 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/json' } }, logout: { url: 'logout', method: 'post', withCredentials: true, }, user: { url: '/api/user', method: 'get', propertyName: 'user', withCredentials: true, headers: { 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/json' } }, home: '/home' }, tokenRequired: false, tokenType: false } } },