On this page
    Quickstart

    Quickstart: Integrate Sign-In with Webburns Account

    Go from zero to a working OAuth 2.0 + OpenID Connect login flow in four steps.

    1. Register an OAuth Client in the Console

    1. Sign in to https://console.webburnstech.dev/clients/create using your Webburns Account.
    2. Enter your Application Name (shown to end users on the consent screen) and choose an Application Type (web, spa, or native).
    3. Add at least one exact Authorized Redirect URI, such as http://localhost:3000/auth/callback for local testing or https://app.example.com/auth/callback for production.
    4. Copy your generated client_id (starts with wb_) and client_secret (starts with wbs_). Store client_secret securely — it is only displayed once when created or rotated.

    2. Configure Branding & Audience (Test Users)

    Every new client starts in Testing publishing status. While in Testing mode, only the client owner and up to 25 allowlisted test users can authorize the app.

    • Open Audience in the Console and add your QA or teammate Webburns Account emails.
    • Any unlisted user who reaches /oauth/authorize receives a 403 access_denied testing notice instead of a consent prompt.

    3. Start the Authorization Request (with PKCE S256)

    Generate a cryptographic state value, a high-entropy code_verifier (43–128 characters), and its SHA-256 base64url digest code_challenge. Redirect the user's browser to:

    JavaScript (Browser / Node PKCE Helper)
    function base64UrlEncode(bytes) {
      return btoa(String.fromCharCode(...new Uint8Array(bytes)))
        .replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
    }
    
    async function createPkcePair() {
      const verifierBytes = crypto.getRandomValues(new Uint8Array(32));
      const codeVerifier = base64UrlEncode(verifierBytes);
      const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier));
      const codeChallenge = base64UrlEncode(digest);
      return { codeVerifier, codeChallenge };
    }
    
    const { codeVerifier, codeChallenge } = await createPkcePair();
    sessionStorage.setItem('wb_pkce_verifier', codeVerifier);
    
    const params = new URLSearchParams({
      client_id: 'wb_your_client_id',
      redirect_uri: 'http://localhost:3000/auth/callback',
      response_type: 'code',
      scope: 'openid profile email',
      state: crypto.randomUUID(),
      code_challenge: codeChallenge,
      code_challenge_method: 'S256',
    });
    
    window.location.href = `https://auth.webburnstech.dev/oauth/authorize?${params.toString()}`;

    4. Exchange Code for Tokens & Fetch Profile

    When Webburns redirects back to your redirect_uri?code=...&state=..., verify that state matches the session value you stored, then send a server-to-server POST request to https://auth.webburnstech.dev/oauth/token:

    cURL — Token Exchange & UserInfo
    curl -X POST https://auth.webburnstech.dev/oauth/token \
      -H "Content-Type: application/x-www-form-urlencoded" \
      -d "grant_type=authorization_code" \
      -d "code=AUTH_CODE_FROM_CALLBACK" \
      -d "redirect_uri=http://localhost:3000/auth/callback" \
      -d "client_id=wb_your_client_id" \
      -d "client_secret=wbs_your_client_secret" \
      -d "code_verifier=YOUR_STORED_CODE_VERIFIER"
    
    # Use the returned access_token to fetch the user's claims:
    curl https://auth.webburnstech.dev/api/userinfo \
      -H "Authorization: Bearer ACCESS_TOKEN"