Multiple Errors using okta-auth-js

Hello!

I am observing multiple errors that are thrown by okta-auth-jslibrary that we are using in single page application developed using react. These errors are not consistent and not reproducible for all users at all times. We would like to capture these errors and re-throw a proper exception or error that can indicate user to retry login once again or simply reload the page.

The errors that are observed till now are -

  1. Authsdkerror the jwt token issued in the future (It was found that if machine date and time is ahead of token issued date by 5 minutes, then this error is thrown. Machine/ laptop date is not in sync with current local time of the user trying to login.)
  2. AuthSdkError: Unable to retrieve OAuth redirect params from storage
  3. Error: AuthApiError

Library versions -
@okta/okta-auth-js”: “^5.9.1”
@okta/okta-react”: “^6.3.0”

Can you please recommend and suggest approach to handle the errors?

1 Like

In general, did you try adding breakpoints so you could determine which method calls were encountering these failures?

  1. “the jwt token issued in the future” should be when the token is retrieved/added to the token storage (so likely on your callback route)
  2. “Unable to retrieve OAuth redirect params from storage” should also be occurring on the callback route, but after the authorization code is returned by Okta and would be encountered with your application not receiving tokens back
  3. the third one is a bit broad, but implies an API call failed.

Finally, remember to always use the latest stable version of our libraries! AuthJS version 5.x and 6.x has since been retired, so you will want to look to update to v7.x.