Giter Site home page Giter Site logo

Comments (5)

cecilia-sanare avatar cecilia-sanare commented on May 24, 2024

@pherrmann Thanks for submitting an issue!

If you end up submitting a PR for this issue then I'd be happy to look at it.
Otherwise I'll try to look into it sometime this week.

from salte-auth.

pherrmann avatar pherrmann commented on May 24, 2024

I don't immediately have a solution. I'll submit a PR if one comes to me.

The state mismatch alerted me in a round-a-bout way that a second login was occurring while the first one was being processed.

Perhaps, it could check to make sure it's not already processing a login when it falls into the $$onRouteChanged flow. $$onRouteChanged appears to be bound to document 'click' and window 'popstate' events

from salte-auth.

cecilia-sanare avatar cecilia-sanare commented on May 24, 2024

Created a small demo showcasing the issue out on Glitch.

Demo

https://salte-auth-135.glitch.me

Steps to Reproduce

  • Enable persistent logs in Chrome (so that the error doesn't get lost)
  • Hit here to clear your cache for that site.
  • Navigate to the mini-app.
  • Login
  • At this point the error SHOULD occur.

from salte-auth.

cecilia-sanare avatar cecilia-sanare commented on May 24, 2024

@pherrmann Let me know if v2.1.3 resolves the issue you were seeing!

from salte-auth.

pherrmann avatar pherrmann commented on May 24, 2024

@cecilia-sanare Your update is an improvement as it's no longer calling login twice. However, it appears I'm ending up with the same issue for a different reason.

After avoiding the extra loginWithIframe call, retrieveAccessToken goes on to make a call to retrieve the access token. This calls $accessTokenUrl which updates the profile's $localState to a new uuid. This results in a state mismatch error and an extra call to retrieve the access token.

Could $$onRouteChanged check for login promises before calling retrieveAccessToken?

$$onRouteChanged() {
  if (!this.$utilities.isRouteSecure(location.href, this.$config.routes)) return;
  if(!this.$promises.login) { // don't retrieve access token while logging in
    this.retrieveAccessToken();
  }	
}

from salte-auth.

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.