# Quick Start

Follow these steps to integrate INFRA into your application. You'll need a registered developer account and an OAuth app.

1. **Register on the Developer Portal** — Visit the INFRA developer portal and create your account. Verify your email to activate access.
2. **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).
3. **Implement the OAuth Flow** — Redirect users to the INFRA authorization endpoint with PKCE. Handle the callback and exchange the code for tokens.
4. **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

```javascript
// 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)

```javascript
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

```javascript
// 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, ... } }
```

---

Source: https://docs.infraidentity.com/quickstart/ · Full docs: https://docs.infraidentity.com/llms-full.txt
