Using test accounts
Test accounts can be used to build automated tests, for local development, or to reduce friction during Apple’s App Store review process for mobile apps. A new set of credentials are created each time you enable the test account, and the old one is revoked to keep your account secure.
To use these test accounts, your app must support email or SMS login. Testing other login flows can either be automated with a library like Playwright, or by completing the flow manually, as it requires authorization with other APIs (such as social providers).
Enabling test accounts
To enable a test account for your app and get its login credentials:
- Go to the User management > Authentication > Advanced tab of the Privy Dashboard
- Turn on the Enable test accounts toggle
Once enabled, you will see the login credentials for your test account that you can use for your app ID.
All test credentials follow the same format, where XXXX
/XXXXXX
in the credentials below should be substituted with the values you see in the User management > Authentication > Advanced page of the Dashboard. You cannot substitute arbitrary values for XXXX
/XXXXXX
or use plus addressing; you must use the credentials from the Dashboard exactly.
phone | OTP (for either) | |
---|---|---|
[email protected] | +1 555 555 XXXX | XXXXXX |
Once enabled, a test user can log into your app with the provided email or phone number and the provided OTP code to review and test your app.
Depending on when you created your Privy app, you may have a legacy test account enabled with the
login credentials [email protected]
or +1 555 555 5555
. Please see the User management >
Authentication > Advanced page of the Privy Dashboard to determine if this is the case for your
app.
Test accounts have a lighter authentication rate limit for apps in development. While all accounts in production apps and non-test accounts in development apps are limited to 5 requests every 5 minutes for email and 5 requests every 10 minutes for SMS, test accounts in development apps are limited to 10 requests every 10 seconds for either.
Getting a test access token programmatically
You can programmatically get an access token for your app’s test account using the getTestAccessToken
method:
This method returns a Promise
that resolves to an object containing the accessToken
string for the test account.
getTestAccessToken
will throw an error if:
- You have not enabled test credentials in the Privy Dashboard
- Allowed origins or base domain are enabled for your app
Was this page helpful?