Introduction
Doshi provides a secure webview authentication system that uses a two-step process:- Generate a nonce token from the Doshi API using your API key
- Pass the token to the embedded Doshi iframe
New to Doshi authentication? Start with the Quick Start Guide for a complete walkthrough.
Authentication Methods
After obtaining your nonce token from the API, you can pass it to the iframe using two methods:postMessage API
Recommended for productionReal-time, secure cross-origin communication. Best for sensitive data and dynamic flows.
Query Parameters
Simple implementationURL-based authentication. Best for quick setup and debugging.
How It Works
1
Client Calls API
Your backend calls
/client/auth/token with your API key to generate a nonce token2
Pass Token to Iframe
Your frontend passes the token to the Doshi iframe using postMessage or query parameters
3
User Authenticates
Doshi iframe handles user authentication, including 2FA if enabled
4
Session Active
User session is managed automatically (1hr ID token + 12hr refresh token)
Data Structure
Required Parameter
Optional Parameters
Basic Setup
1. Get Your API Key
Contact [email protected] to receive your static API key.2. Generate Nonce Token
3. Embed the Webview
4. Pass Token to Iframe
Choose your preferred method:2FA Support
When 2FA is enabled for your organization, pass the required user information:- Display the OTP input screen
- Send the OTP to the user’s phone
- Verify the OTP
- Complete authentication
You don’t need to call
/client/auth/send-otp or /client/auth/verify-otp separately. The iframe handles the entire 2FA flow.Session Management
Once authenticated, sessions are managed automatically:- ID Token: Valid for 1 hour
- Refresh Token: Valid for 12 hours
- Auto-refresh: Tokens are refreshed automatically by the iframe
Parameter Details
segment
Thesegment parameter is used for handling multiple learning paths under the same organization. This allows you to direct users to different educational journeys based on their needs or preferences.
Example:
branchId
Used to identify which branch or location the user belongs to within your organization. Example:Mobile App Considerations
When embedding Doshi Frontend in mobile apps:Disable Zoom
Prevent pinch-to-zoom for consistent UI
Handle Keyboard
Adjust layout when keyboard opens
Handle Links
Implement link click callbacks
