Handling Errors
SDK Errors
Backend SDKs
Exceptions
The backend SDKs will throw an exception (or your language's equivalent) when the API returns a non-200
status code.
Alongside the status code, the HTTP response content will contain a human-readable explanation of the reason for failure.
An exception will also be thrown if an HTTP request itself fails (e.g. due to a network failure).
Frontend and Mobile SDKs
User Cancelation
If a user cancels a Session (e.g. by hitting the "close" button), no exception will be thrown, as this is not considered an error state.
Instead, the asynchronous call to launch the Session will resolve with a result indicating that the user requested cancellation.
Exceptions
Info
Session failures (e.g. expiration, failed authenticity checks, or user cancellation) do not result in exceptions being thrown in the frontend SDKs.
Instead, the failure reason will be available on the Session object itself, as described in Session Failure.
The frontend and mobile SDKs primarily throw exceptions in the following circumstances:
- Invalid
callbackUrl
provided to Mobile SDK- If your mobile application has not been properly configured with a custom scheme as described in the mobile SDK documentation, an exception will be thrown
- Underlying OS/browser API failure
- For example, if the user's browser blocks a popup launch
Session Failure
Sessions can fail (indicated by the Failed
state) for a number of reasons, ranging from expiration to failed authenticity checks.
Session Fail Code
When a Session is in the Failed
state, the reason for failure is present in the FailCode
property of the Session object.
Fail Code | Description |
---|---|
None | The Session has not failed |
Internal | An internal error has caused the Session to fail |
VerificationFailed | A verification failure (invalid/unreadable images, mismatched selfie, etc.) has caused the Session to fail. See Verification Fail Code for further information. |
Authentication | The user exceeded limits on authentication attempts |
Expired | The Session expired |
UserCanceled | The user canceled the Session |
RpCanceled | The Relying Party (you) canceled the Session via the CancelSession call |
Verification Fail Code
If a Session's failure reason is Verification-related (that is, the user's attempt to verify themselves with a specific ID provider failed), its FailCode
will be set to VerificationFailed
, and additional information will be present on the Verification.FailCode
property of the Session object.
Verification Fail Code | |
---|---|
None | The Session either did not fail, or its failure was unrelated to a Verification |
Internal | An internal error caused the Verification to fail |
InvalidImage | The user provided an image that could not be processed (low quality, blurry, not of an ID document, etc.) |
Inauthentic | The identity provider rejected the Verification attempt as potentially fraudulent |
UnsupportedDocument | The document provided by the user is not in the list of supported documents |
Updated about 2 months ago