AgnicPay

O Auth

OAuth 2.0 authentication flow

Start OAuth Authorization

Start the OAuth 2.0 authorization code flow. Redirect users to this endpoint to request permission to make payments on their behalf.

GET
/oauth/authorize

Query Parameters

client_id
Required
string

Your application identifier

redirect_uri
Required
string

URL to redirect after authorization

Format: "uri"
state
Required
string

CSRF protection token (returned unchanged)

scopestring

Space-separated scopes

Default: "payments:sign balance:read"
response_type
Required
string

Must be "code"

Value in: "code"
code_challengestring

PKCE code challenge (recommended)

code_challenge_methodstring

PKCE method

Default: "S256"Value in: "S256"
promptstring

Controls consent behavior:

  • none: Silent auth only (error if consent needed)
  • consent: Force consent screen
  • login: Force re-authentication
Value in: "none" | "consent" | "login"
curl -X GET "https://api.agnic.ai/oauth/authorize?client_id=string&redirect_uri=http%3A%2F%2Fexample.com&state=string&scope=payments%3Asign+balance%3Aread&response_type=code&code_challenge=string&code_challenge_method=S256&prompt=none"

Redirect to consent page or callback

Exchange Tokens

Exchange authorization code for access token, or refresh an access token.

POST
/oauth/token

Request Body

application/jsonRequired
body
Required
object | object
curl -X POST "https://api.agnic.ai/oauth/token" \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "authorization_code",
    "code": "string",
    "redirect_uri": "http://example.com",
    "client_id": "string",
    "code_verifier": "string"
  }'

Tokens issued successfully

{
  "access_token": "string",
  "refresh_token": "string",
  "token_type": "Bearer",
  "expires_in": 0,
  "scope": "string"
}

OAuth Server Metadata

OAuth 2.0 Authorization Server Metadata (RFC 8414)

GET
/.well-known/oauth-authorization-server
curl -X GET "https://api.agnic.ai/.well-known/oauth-authorization-server"

Server metadata

{
  "issuer": "string",
  "authorization_endpoint": "string",
  "token_endpoint": "string",
  "scopes_supported": [
    "string"
  ],
  "response_types_supported": [
    "string"
  ],
  "grant_types_supported": [
    "string"
  ]
}