How to do propper error handling on okta-signin-widget/okta-react/okta-auth-js

Hi! - A questions about propper error handling/logging.

We are seeing many of our users experiencing issues login into our application.
We are using Okta Signing Widget in a React application, and to get the tokens we use the showSignInToGetTokens method. on the return the tokens are set using oktaAuth.handleLoginRedirect(tokens).

It seems to work as intended, but we keep getting reports from users having issues logging into the application. Trying to debug this have proven quite hard, since the errors we are able to log are really not very helpfull.

The .catch on showSignInToGetTokens have not triggered, meaning that the issues must happen before or after that step.

Using signIn.on("afterError"... we get the same generic message for every error we encounter: "message":"Authentication failed".

I must be missing some simple way of getting more detailed error messages to help me debug these issues?

Hope someone in here can point me in the right direction! :slight_smile:

Given that only a subset of users are having issues, I would take a look at the logs (Reports > System Logs) and see why the Authentication is failing (invalid user, MFA issues, incorrect password, sign on policies, etc). The authn API will return an error code to provide a general idea of what is wrong (Okta API Error Codes | Okta Developer), but doesn’t tell you exactly what’s wrong for security reasons. Thus, the system logs (expanded all) will give you a better idea of why a subset of users are having issues logging in. Perhaps try filtering by eventType eq "user.session.start".