Login with Recovery Code
Recovery codes provide an emergency access method when you cannot use your standard Multi-Factor Authentication (MFA) methods. This scenario demonstrates how to authenticate using a recovery code when MFA is enabled on your account. Key benefits:- Emergency access when standard MFA factors are unavailable
- One-time use codes that are consumed after successful authentication
- Alternative authentication path that still maintains security
Prerequisites
This scenario assumes:- The user has active MFA on their account
- Recovery codes have been generated beforehand
Recovery codes should be stored securely. They are intended for emergency use only when you cannot access your primary MFA methods.
Step 1 - Login with MFA-enabled account
Authenticate with your username and password to obtain a session token. Since your account has MFA enabled, the token will be returned in a locked state.- This initial authentication verifies your first factor (something you know - your password)
- The returned token will be locked and requires additional verification
- Instead of using standard MFA factors, we’ll use a recovery code in the next step
- token - Located at
tokenin the response.- The authentication token that should be included in subsequent API requests. This token identifies your session and provides access to authorized resources.
- Example value:
o0OkzzNi1Q8PNsZWCLkdUTGlHfUaHQzN3Fx2DTnCkdyFp3jbCbRR9XAf1fehyFBF
Step 2 - Unlock the session token using a recovery code
When you cannot access your standard MFA methods (email, SMS, or authenticator app), you can use a recovery code to unlock your session token. Recovery codes are emergency backup codes that you should have generated and stored securely before needing them. EndpointStep 3 - Test the session token by retrieving available documents (Optional)
This endpoint demonstrates how to use your unlocked session token to perform an actual operation - in this case, searching for available documents in the system.- The session token is passed in the query parameters
- The search operation returns documents the authenticated user has access to
- This pattern applies to all token protected API endpoints - include your session token in each request
This is a practical example of how to use your session token for API operations. Do not call this endpoint if you don’t wish to perform a search operation.
Step 4 - Terminate the session (Optional)
Invalidates the current session token, effectively logging the user out of the system. This is an important security practice to prevent unauthorized access after a session is no longer needed.- Invalidates the token provided in the request
- Prevents the token from being used for any future API requests
- Should be called when a session is no longer needed
- Does not affect other active sessions for the same user
This endpoint only invalidates the specific token provided in the request. Other active sessions for the same user will remain valid.
Recovery Code Login Summary
Recovery codes provide an emergency authentication method when standard MFA factors are unavailable:- Recovery codes must be generated in advance
- Each recovery code can only be used once and is consumed after successful authentication
- Recovery codes should be stored securely and used only in emergency situations
Example Recovery Code Login Flow
See our OpenAPI documentation to learn about the full set of API endpoints and parameters.
Please use proper exception handling and function decomposition in your own code. The code is provided for illustrative purposes only and is not intended for production use.