Giter Site home page Giter Site logo

Comments (26)

steklopod avatar steklopod commented on May 8, 2024 4

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.

DougHayward avatar DougHayward commented on May 8, 2024 3

You never provided any code to reproduce, so how can we help?

from auth-module.

breakingrobot avatar breakingrobot commented on May 8, 2024

@venturion

Could you give us more details and code to reproduce your issue, thanks.

from auth-module.

venturion avatar venturion commented on May 8, 2024

@breakingrobot

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

bug

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.

fanckush avatar fanckush commented on May 8, 2024

What do you have in nuxt config for auth -> redirect ?

from auth-module.

venturion avatar venturion commented on May 8, 2024

@fanckush

that's my config for redirect

redirect: { login: '/entrar', home: '/' },

from auth-module.

fanckush avatar fanckush commented on May 8, 2024

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.

venturion avatar venturion commented on May 8, 2024

@fanckush

my case is a little bit different, i'm using global auth middleware

from auth-module.

fanckush avatar fanckush commented on May 8, 2024

It is indeed different but in the other case i am also using auth middleware globally as well

from auth-module.

venturion avatar venturion commented on May 8, 2024

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.

venturion avatar venturion commented on May 8, 2024

i can't access store values from middleware?
how can't i get the authentication state from from middleware?

from auth-module.

venturion avatar venturion commented on May 8, 2024

@breakingrobot

any temporary solution to this bug?

from auth-module.

breakingrobot avatar breakingrobot commented on May 8, 2024

@venturion

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.

venturion avatar venturion commented on May 8, 2024

@breakingrobot

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.

fanckush avatar fanckush commented on May 8, 2024

@venturion

when i reload the home page
even authenticated it's returning false

Maybe it is related to this in way? #53

from auth-module.

breakingrobot avatar breakingrobot commented on May 8, 2024

@venturion

Related to #58 - please verify your propertyName

from auth-module.

venturion avatar venturion commented on May 8, 2024

@breakingrobot

its seems to be a redirect error, redirect not changes the layout from login to home page!

from auth-module.

breakingrobot avatar breakingrobot commented on May 8, 2024

@venturion

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.

nahue avatar nahue commented on May 8, 2024

im guessing you are not preserving your vuex store through refreshes, im trying to do the same hehe

from auth-module.

venturion avatar venturion commented on May 8, 2024

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.

breakingrobot avatar breakingrobot commented on May 8, 2024

@venturion Why did you close this, have you found a solution ?

from auth-module.

venturion avatar venturion commented on May 8, 2024

@breakingrobot nobody answer this question

from auth-module.

breakingrobot avatar breakingrobot commented on May 8, 2024

@venturion

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.

borodyadka avatar borodyadka commented on May 8, 2024

@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.

breakingrobot avatar breakingrobot commented on May 8, 2024

Related issues are fixed on 4.0, please check your API responses too 👍

from auth-module.

vadymsem avatar vadymsem commented on May 8, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.