authClient.tx.exists() issue


#1

Trying to perform some action on a page after the login page using authClient.tx.exists().then but getting an error that .then is not a function. Why?


#2

Probably because tx.exists() is synchronous.
Usage - https://github.com/okta/okta-auth-js#txexists


#3

The developer.okta.com docs are incorrect then as the sample is different than what is shown in GitHub.

Connie DeCinko, Programmer Analyst
T: 602.340.7290 F: 602.416.7490


#4

Thank you for bringing it to our notice. We will update the docs soon.
Here’s the updated code snippet in case you need it -

var exists = authClient.tx.exists();
if (exists) {
  authClient.tx.resume()
  .then(function(transaction) {
    console.log('current status:', transaction.status);
  })
  .fail(function(err) {
    console.error(err);
  });
}