Egreed ID · OAuth 2.1 · OpenID Connect

Authorization code with PKCE

Egreed ID is EGREED Technologies’ identity platform for single sign-on, passkeys, device trust, and scoped access. Connect your application using OAuth 2.1 and OpenID Connect.

Quickstart

Register an OAuth application in the developer console, copy its client ID, and register your exact callback URI. Generate a random verifier, derive its S256 challenge, and retain the verifier, state, and nonce for the callback. Use an OIDC library to manage these values safely.

authorize.ts
// Redirect the user to Egreed ID
// Persist a random state and nonce for this sign-in attempt.
const params = new URLSearchParams({
  client_id: "egr_client_...",
  redirect_uri: "https://app.example.com/callback",
  response_type: "code",
  scope: "openid profile email",
  state: "YOUR_RANDOM_STATE",
  nonce: "YOUR_RANDOM_NONCE",
  code_challenge: "YOUR_S256_CHALLENGE",
  code_challenge_method: "S256"
});

window.location.href =
  "https://id.egreedtech.org/oauth/authorize?" + params;

How it works

01

Authorize

Redirect to Egreed ID with your client ID, requested scopes, state, and PKCE challenge.

02

Exchange

Validate state, then exchange the one-time code and original verifier for signed tokens.

03

Verify

Validate RS256 ID tokens offline with the published JWKS, including issuer, audience, and expiry.

Exchange the authorization code

Exchange the code from the callback immediately. The redirect URI must exactly match the value used during authorization.

cURL
curl -X POST https://id.egreedtech.org/api/public/oauth/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=authorization_code" \
  -d "code=AUTHORIZATION_CODE" \
  -d "code_verifier=YOUR_ORIGINAL_VERIFIER" \
  -d "client_id=egr_client_..." \
  -d "redirect_uri=https://app.example.com/callback"
Long-lived sessions. Request offline_access to receive a refresh token. Refresh tokens rotate on every use; reusing an old token revokes the full token chain.

Next steps