Skip to main content

Overview

Query parameter authentication is a simpler approach that passes authentication data through the URL. This method is ideal for quick implementation and debugging.
Query parameters are visible in URLs and browser history. While the custom token is short-lived, consider using postMessage for production environments.

How It Works

1

Generate Custom Token

Your backend calls the Doshi API to get a custom token
2

Build URL

Construct the webview URL with the token and other data as query parameters
3

Load Webview

Load the iframe with the constructed URL
4

Webview Authenticates

Webview extracts parameters and authenticates the user, handling 2FA if needed

React Implementation

Complete Example with API Call

Usage Example

Vanilla JavaScript Implementation

Parent Window

HTML Structure

Child Window (Webview) - Reading Query Parameters

This section is for reference only. The Doshi iframe already implements this functionality.

Reading Parameters

Clearing Sensitive Parameters

Clear sensitive parameters from the URL after reading to prevent exposure in browser history

URL Encoding

Properly encode special characters in parameters:

URL Parameter Reference

Required Parameters

string
required
The nonce token received from the Doshi API

Optional Parameters

string
User’s email address
string
Used for handling multiple learning paths under the same organization
string
Branch or location identifier
pathId is not a URL parameter. Adding it to the iframe URL has no effect — it is silently ignored. Set the starting path when you generate the token instead. See Setting the Starting Learning Path.

2FA Parameters

boolean
Set to true to enable 2FA flow in the iframe
string
User’s date of birth in YYYY-MM-DD format (required for 2FA)
string
Your organization ID (required for 2FA)
string
Your internal user ID (required for 2FA)
string
User’s first name (required for 2FA)
string
User’s last name (required for 2FA)

Comparison: postMessage vs Query Parameters

Common Issues

Problem: URL exceeds browser limits (typically 2000 characters).Solutions:
  1. Use shorter tokens or references
  2. Switch to postMessage method
  3. Only include essential parameters
Problem: Special characters in parameters causing issues.Solution:
Problem: Query parameters not accessible in the webview.Solution:

Next Steps

Security Guidelines

Review security considerations

Best Practices

Optimize your implementation