Testing Mode & Dev Teleport
Skip OAuth popups during E2E testing and development. Initialize the SDK with a test key (pk_test_) to automatically enable Dev Teleport.
How it works
Generate a test API key (pk_test_...) from your project in the Authon dashboard.
Initialize the SDK with the pk_test_ key in your development environment.
A Dev Teleport section automatically appears at the bottom of the login modal. Enter an email and click Go to sign in instantly without OAuth.
Dev Teleport only works with pk_test_ keys. With pk_live_ keys, the Dev Teleport UI is hidden and the API endpoint returns an error. It never works in production.
SDK Usage
When initialized with a pk_test_ key, the login modal automatically shows Dev Teleport. No additional setup required.
import { Authon } from '@authon/js';
// Use pk_test_ key for development
const authon = new Authon(
'pk_test_your_test_key_here',
{ theme: 'dark' }
);
// Open the login modal — Dev Teleport appears automatically
await authon.openSignIn();Programmatic Usage
You can also perform test sign-in directly from code without the modal UI.
const authon = new Authon('pk_test_xxx', { theme: 'dark' });
// testing is only available with pk_test_ keys
// With pk_live_ keys, authon.testing is undefined
const user = await authon.testing?.signIn({
email: 'test@example.com',
nickname: 'Tester' // optional
});
console.log(user); // { id, email, displayName, ... }If no user with that email exists in the project, one is automatically created. If the user already exists, a token is issued for the existing user.
E2E Testing Integration
Bypass OAuth popups in E2E testing frameworks like Playwright or Cypress and test with an authenticated state instantly.
API Reference
/v1/auth/testing/tokenIssue an authentication token for a test user instantly. Only available with pk_test_ keys.
Request Headers
| x-api-key | Publishable key starting with pk_test_ |
Request Body
{
"email": "test@example.com",
"nickname": "Tester" // optional
}Response
{
"accessToken": "eyJ...",
"refreshToken": "rt_...",
"expiresIn": 900,
"user": {
"id": "uuid",
"email": "test@example.com",
"displayName": "Tester",
"emailVerified": true
}
}Calling this endpoint with a pk_live_ key returns a 400 error. Generate test keys in Authon Dashboard > Project > API Keys.
Environment Variables
Use separate environment variables for development and production keys.
This way, Dev Teleport is automatically enabled or disabled based on the environment — no code changes needed.