Comments (26)
My problem was using:
$axios.defaults.baseURL = process.env.DOCKER_HOST_WINDOWS || process.env.DOCKER_HOST;
instead of
$axios.defaults.baseURL = process.env.DOCKER_HOST || process.env.DOCKER_HOST_WINDOWS ;
Looks like a stupid bug of axios
, not auth module
.
from auth-module.
You never provided any code to reproduce, so how can we help?
from auth-module.
Could you give us more details and code to reproduce your issue, thanks.
from auth-module.
i'm already authenticated inside homepage, but when i press F5 the page first goes to login page and after this go to home page, but the layout stay the login layout, as you can see in the vue console
i have different layouts for login page and for home page, the problem is with the persistence after reload the home page
from auth-module.
What do you have in nuxt config for auth -> redirect ?
from auth-module.
that's my config for redirect
redirect: { login: '/entrar', home: '/' },
from auth-module.
I think in a way this is related to this issue: #54
I am as lost as you are but i remember getting a similar warning when calling auth.redirect() in a component before it is loaded in the client side (in fetch() for example)
I cant wrap my head around what is happening but hopefully this helps..
from auth-module.
my case is a little bit different, i'm using global auth middleware
from auth-module.
It is indeed different but in the other case i am also using auth middleware globally as well
from auth-module.
i'm monitoring
store.state.auth.loggedIn
inside a middleware
when i reload the home page
even authenticated it's returning false
from auth-module.
i can't access store values from middleware?
how can't i get the authentication state from from middleware?
from auth-module.
any temporary solution to this bug?
from auth-module.
I use my personal project and the kitchensink examples to try to reproduce errors and detect issues.
I was unable to reproduce it with our current code base and that's why I asked for a code reproduction in the first place, so please mention :
- Which operating system are you using ?
- Which version of auth-module are you using ?
- How did you manage to get this error ? (code reproduction)
- How did you run your application ? (SSR / SPA / ...)
- Which Nuxt variant are you using ? (Vanilla, using class-component through Babel, using Typescript ?)
These details matters for us to analyse, reproduce then fix the error.
from auth-module.
Which operating system are you using ?
windows 10
Which version of auth-module are you using ?
4.0.0-rc.3
How did you manage to get this error ? (code reproduction)
aparently all seems to be ok except when i reload the homepage after do the autentication, the login dont persists, and its return to the login page
How did you run your application ? (SSR / SPA / ...)
ssr
Which Nuxt variant are you using ? (Vanilla, using class-component through Babel, using Typescript ?)
babel
from auth-module.
when i reload the home page
even authenticated it's returning false
Maybe it is related to this in way? #53
from auth-module.
Related to #58 - please verify your propertyName
from auth-module.
its seems to be a redirect error, redirect not changes the layout from login to home page!
from auth-module.
It does not redirect because of your store.state.auth.loggedIn
which is not set, please, verify if your propertyName
on user
is valid, or set it to false
to test, then report the results here.
I'm still waiting on a code repro..
from auth-module.
im guessing you are not preserving your vuex store through refreshes, im trying to do the same hehe
from auth-module.
my nuxt.config.js settings
{ modules: [ "@nuxtjs/auth", "@nuxtjs/axios", "@nuxtjs/dotenv", "@nuxtjs/router" ], auth: { endpoints: { login: { url: "/user/auth/login", method: "post", propertyName: "access_token" }, logout: { url: "/user/auth/logout", method: "get" }, user: { url: "/user/auth/data", method: "get", propertyName: "user" } }, redirect: { login: "/entrar", logout: "/entrar", home: "/" } } }
my login page has a differente layout from the home page
from auth-module.
@venturion Why did you close this, have you found a solution ?
from auth-module.
@breakingrobot nobody answer this question
from auth-module.
There are similar issues to your own and others issues that are still unresolved, we are putting our best effort into fixing bugs and implementing new features and ideas on auth-module.
Meanwhile, I asked for code reproduction several times (here - here) and at this time, we have no code reproduction to at least reproduce your specific problem while in similar issues like #58, #54 or #53, we have some clues and code reproduction about this issue.
Your nuxt.config.js
is not enough, I also asked you to check your propertyName
and had no response what so ever about it.
I am not trying to be mean in anyway, but you have to understand that we cannot work or help you on this issue if you are not being specific and cooperative.
We don't know what kind of API you are using and how are you handling your requests and your states, because we have no information at all about your code and have no clue on how to reproduce it.
I sincerely hope you understand.
from auth-module.
@venturion
I'm facing the same problem, but fixed it. In my case it was not porblem with auth-module itself. On the server-side, nuxt was unable to make requests to auth service and fetch user data. So nuxt server "thinks" user is not authorized, then on client-side browser redirects user to login page, sends request to endpoints.user
(with credentials stored in browser), receiving user data and redirects user back.
Make sure your nuxt server can get data from auth service.
from auth-module.
Related issues are fixed on 4.0, please check your API responses too 👍
from auth-module.
@venturion Today I faced exactly with the same issues. At least I got the same behaviour. In my case mismatching client-side virtual DOM and server-side was related to using component.
So, the main point I was broking my mind it why the system logs me out each time once I reload the window? It happens only on production. Once I run it on localhost it works. I spent some time to notice that I got auth.token set to false each time after reloading. But it should be bearer token. Setting same-site cookies options helps me. Nuxt auth module also provide a way to configure it by the next way:
nuxt.config.js
auth: {
cookie: {
options: {
sameSite: 'lax',
}
}
More about SameSite cookies you can read here:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
Hope my answer will help someone.
from auth-module.
Related Issues (20)
- For openIDConnect, clientSecret is not included in the request to exchange access token HOT 3
- cookie not working on subdomains
- module authenticates even when has error HOT 1
- Token may be expired by the time server receives it
- Deprecation alert
- Google login issue HOT 3
- Auth.* cookie should not be set if the user isn't logged in HOT 1
- nuxt.config.ts not loading auth from nuxt.config.ts HOT 1
- Questions about cognito authentication with nuxt2 + nuxt-auth + aws-amplify HOT 2
- $auth loginWith function not setting this.$auth.user data
- Mastodon Support
- Options not working in cookie strategy
- token.type missing
- Keycloak with oauth2 - No login redirection with app on server, but runs locally HOT 1
- Normal signout process with IdentityServer4 (OIDC)
- Need to create custom Login page in route app and display server error there
- doc: broken link on Nuxt 3 Support > Lucia & Nuxt Auth Template
- Is there any npm library for Facebook login only (Nuxt 3/Vue 3) HOT 1
- Security issue: Uses a vulnerable version of Axios
- All features work fine under npm run dev, but when starting with npm run start, after logging in and fetching the user, the page cannot be refreshed. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from auth-module.