Quick Start
Follow these steps to integrate INFRA into your application. You'll need a registered developer account and an OAuth app.
- Register on the Developer Portal — Visit the INFRA developer portal and create your account. Verify your email to activate access.
- Create an OAuth App — In the portal, create a new application. You'll receive a client_id and client_secret. Set your redirect_uri(s).
- Implement the OAuth Flow — Redirect users to the INFRA authorization endpoint with PKCE. Handle the callback and exchange the code for tokens.
- Call the User Data API — Use the access token to call INFRA API endpoints and retrieve verified user data and signed claims.
Step 1: Redirect user to INFRA authorization#
// Generate PKCE code verifier and challenge first
const authUrl = new URL('https://auth.infraidentity.com/oauth2/auth');
authUrl.searchParams.set('response_type', 'code');
authUrl.searchParams.set('client_id', 'YOUR_CLIENT_ID');
authUrl.searchParams.set('redirect_uri', 'https://yourapp.com/callback');
authUrl.searchParams.set('scope', 'kyc:read profile:read claims:read');
authUrl.searchParams.set('state', generateState());
authUrl.searchParams.set('code_challenge', codeChallenge);
authUrl.searchParams.set('code_challenge_method', 'S256');
window.location.href = authUrl.toString();
Step 2: Exchange code for tokens (backend)#
const response = await fetch('https://auth.infraidentity.com/oauth2/token', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({
grant_type: 'authorization_code',
code: authorizationCode,
redirect_uri: 'https://yourapp.com/callback',
code_verifier: codeVerifier,
client_id: 'YOUR_CLIENT_ID',
client_secret: 'YOUR_CLIENT_SECRET',
}),
});
const { access_token, refresh_token, expires_in } = await response.json();
Step 3: Fetch verified user data#
// Get user profile
const profile = await fetch(
'https://api.infraidentity.com/api/v1/users/{userId}/profile',
{ headers: { 'Authorization': `Bearer ${accessToken}` } }
);
const data = await profile.json();
// { success: true, data: { id, email, first_name, kyc_level, ... } }