OAuth Integration
How OAuth Works
typescriptFor GitHub and Twitter modules, the SDK uses popup-based OAuth:
User Initiates: User clicks verify
Popup Opens: Centered popup window opens
Authorization: User authorizes in OAuth provider
Token Exchange: Backend exchanges code for access token
Token Transfer: Popup sends token to SDK via postMessage
Verification: SDK uses token to call attestation API
Cleanup: Popup closes automatically
Security Features:
CSRF protection via state parameter
PKCE for Twitter OAuth 2.0
HttpOnly cookies for token storage
Origin validation (ready for production)
5-minute timeout protection
Step 1: Create OAuth App
Go to GitHub Settings → Developer Settings → OAuth Apps
Click "New OAuth App"
Fill in details:
Application name: Your App Name
Homepage URL: Your app URL
Authorization callback URL: `https://your function useUntracedModal(): UseUntracedModalReturn
Step 2: Configure Environment
Add to .env.local:
Step 3: Test
Twitter Setup
Step 1: Create Twitter App
Go to Twitter Developer Portal
Create new App
Enable OAuth 2.0
Set callback URL:
https://yourdomain.com/api/auth/twitter/callbackEnable PKCE
Set scopes:
tweet.read,users.read,offline.access
Step 2: Configure Environment
Add to .env.local:
Step 3: Test
Last updated