Search code examples
node.jsexpressstormpathexpress-stormpath

Token is Invalid or Invalid state token provided


So i'm running into a problem I suspect I shouldn't be having and having tried several things i'm seemingly at an impasse.

I am trying to integrate LinkedIn login with Stormpath and it seems the accounts get created and technically the user is logged in, the application does return one of two errors: "Token is invalid" or "Invalid state token provided."

I checked my id and secret several times and the authorized callback urls etc but I'm not sure where else to actually check, some help would be appreciated.

To try further I did in fact clone https://github.com/stormpath/stormpath-express-react-example and run it, and everything else works fine but again LinkedIn login on this app doesn't work so I suspect its not my code (maybe, after years of coding I'm never really comfortable saying its not my code, but there you have it).

I have attached the screenshot of things in case my now very tired eyes are missing something. Can someone point me to my mistake please?

enter image description hereenter image description here


Solution

  • For reference, Omar and I looked through this problem and realized that his server was not running ntp, and the clock was running fast.

    This meant that the signed token request generated by Stormpath's Express integration was sent to Stormpath's REST API with a different valid time interval than expected, and thus failed validation.

    We fixed it by installing ntp and syncing the server's time.