Avnology ID
API ReferenceOAuth 2.1 / OIDC

Authorization Endpoint

Initiate the OAuth 2.1 authorization code flow with PKCE to obtain an authorization code.

Endpoint

GET /oauth2/auth

Base URL: https://api-id.avnology.net

Authentication: None (user authenticates interactively)

Initiates an OAuth 2.1 authorization code flow. The user is redirected to the Avnology ID login page, and after authentication and consent, redirected back to your redirect_uri with an authorization code.

PKCE (code_challenge) is required for all clients (OAuth 2.1 mandate).

Request

Query Parameters

ParameterTypeRequiredDescription
response_typestringYesMust be code
client_idstringYesYour OAuth application's client ID
redirect_uristringYesMust exactly match a registered redirect URI
scopestringYesSpace-separated scopes (e.g., openid profile email)
statestringRecommendedRandom string for CSRF protection
code_challengestringYesBase64url-encoded SHA-256 hash of code_verifier
code_challenge_methodstringYesMust be S256
noncestringNoRandom value for ID token replay protection
promptstringNonone, login, or consent
login_hintstringNoPre-fill the email field
organization_idstringNoRestrict to a specific organization

Example Request

# Step 1: Generate PKCE values
CODE_VERIFIER=$(openssl rand -base64 32 | tr -d '=/+' | cut -c1-43)
CODE_CHALLENGE=$(echo -n "$CODE_VERIFIER" | openssl dgst -sha256 -binary | base64 | tr -d '=' | tr '/+' '_-'










Response

Success -- Redirect with Authorization Code

After the user authenticates and consents, the browser is redirected to:

https://app.acme.com/callback?code=auth_code_abc123def456&state=<your_state>

Error -- Redirect with Error

https://app.acme.com/callback?error=access_denied&error_description=The+user+denied+the+request&state=<your_state>
ErrorDescription
invalid_requestMissing or invalid parameter
unauthorized_clientClient not authorized for this grant type
access_deniedUser denied consent
unsupported_response_typeMust be code
invalid_scopeRequested scope is invalid
server_errorInternal error

Complete PKCE Flow

JavaScript

import crypto from 'crypto';

function generatePKCE() {
  const verifier = crypto.randomBytes(32).toString('base64url');
  const challenge = crypto.createHash('sha256').update(verifier).

















Python

import secrets
import hashlib
import base64
from urllib.parse import urlencode

def generate_pkce():
    verifier = secrets.token_urlsafe(32)
    digest 
















Go

func buildAuthorizationURL(clientID, redirectURI string, scopes []string) (authURL, codeVerifier, state string) {
	verifierBytes :=






















Available Scopes

ScopeDescription
openidRequired for OIDC. Returns an ID token.
profileUser's name, username, avatar
emailUser's email and verification status
phoneUser's phone and verification status
offline_accessReturns a refresh token
admin:users:readRead user management APIs
admin:users:writeWrite user management APIs
admin:orgs:readRead organization APIs
admin:orgs:writeWrite organization APIs
admin:permissions:readRead permission APIs
admin:permissions:writeWrite permission APIs