Developer Testing Console
Test the OAuth 2.0 flow with your AIVerID™ account
GET https://aiverid-backend-production.up.railway.app/oauth/authorize ?client_id=aiv_50de5e3f702bfe688230d13d &redirect_uri=https://aivisibilityrights.com/oauth/callback &response_type=code &scope=profile+email &state=random_state_string
https://aivisibilityrights.com/oauth/callback ?code=AIV_AUTH_CODE_HERE &state=random_state_string
POST https://aiverid-backend-production.up.railway.app/oauth/token Content-Type: application/x-www-form-urlencoded grant_type=authorization_code &code=AUTHORIZATION_CODE &client_id=aiv_50de5e3f702bfe688230d13d &client_secret=YOUR_CLIENT_SECRET &redirect_uri=https://aivisibilityrights.com/oauth/callback
GET https://aiverid-backend-production.up.railway.app/oauth/userinfo Authorization: Bearer ACCESS_TOKEN_HERE Response: { "sub": "TH1234567890", "aiverid": "TH1234567890", "given_name": "John", "family_name": "Doe", "name": "John Doe", "email": "john.doe@example.com", "email_verified": true, "account_type": "individual", "country": "TH", "verification_level": 1, "ai_rights_tokens": [ { "type": "AIVID", "id": "AIVID-TH1234567890", "status": "active" }, { "type": "AIPLT", "id": "AIPLT-TH1234567890", "status": "reserved" }, { "type": "SLIVR", "id": "SLIVR-TH1234567890", "status": "active" } ] }
// Step 1: Redirect to authorization const authUrl = new URL('https://aiverid-backend-production.up.railway.app/oauth/authorize'); authUrl.searchParams.set('client_id', 'aiv_50de5e3f702bfe688230d13d'); authUrl.searchParams.set('redirect_uri', 'https://yourapp.com/callback'); authUrl.searchParams.set('response_type', 'code'); authUrl.searchParams.set('scope', 'profile email tokens'); authUrl.searchParams.set('state', generateRandomState()); window.location.href = authUrl.toString(); // Step 2: Handle callback const urlParams = new URLSearchParams(window.location.search); const code = urlParams.get('code'); const state = urlParams.get('state'); // Verify state matches if (state !== savedState) { throw new Error('Invalid state parameter'); } // Step 3: Exchange code for tokens const tokenResponse = await fetch('https://aiverid-backend-production.up.railway.app/oauth/token', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams({ grant_type: 'authorization_code', code: code, client_id: 'aiv_50de5e3f702bfe688230d13d', client_secret: 'YOUR_CLIENT_SECRET', redirect_uri: 'https://yourapp.com/callback' }) }); const tokens = await tokenResponse.json(); // Step 4: Use access token const userResponse = await fetch('https://aiverid-backend-production.up.railway.app/oauth/userinfo', { headers: { 'Authorization': `Bearer ${tokens.access_token}` } }); const userInfo = await userResponse.json(); console.log('User Info:', userInfo);