Developer Documentation
DAR Open Network
  • Overview
  • DAR ID
    • Introduction
    • Client ID Registration
    • Authentication
      • 1. Request DAR ID Identity
      • 2. Exchange Code for Access Token
      • 3. Refresh Access Token
      • 4. Get Access Token Details
      • 5. Get User DAR ID Information
    • Security Best Practices
  • DeAI
    • Multi-Agent Framework
      • Development Guide
      • Agent Options
      • Endpoints Overview
    • aiNFT Framework
      • Overview
      • Chat with an NFT Agent
      • Generate a Story for an NFT Agent
      • Group Chat Between Multiple NFT Agents
    • Game Asset Generator
Powered by GitBook
On this page
  1. DAR ID
  2. Authentication

2. Exchange Code for Access Token

Endpoint:

POST <https://$>{AUTH_DOMAIN}/oauth2/token
Content-Type: application/x-www-form-urlencoded

Parameters:

Parameter
Type
Description

client_id

string

Your DAR ID client ID

client_secret

string

Your DAR ID client secret

code

string

The code received from step 1

grant_type

string

Must be "authorization_code"

redirect_uri

string

Must match the URI from step 1

code_verifier

string

Required if PKCE was used in step 1

Example Request:

curl -X POST ${AUTH_DOMAIN}/oauth2/token \\\\
  -H "Content-Type: application/x-www-form-urlencoded" \\\\
  -d "client_id=${CLIENT-ID}&client_secret=${CLIENT-SECRET}&code=${CODE}&grant_type=authorization_code&redirect_uri=${REDIRECT-URI}"

Response:

{
  "access_token": "${access_token}",
  "expires_in": 86400,
  "refresh_token": "${refresh_token}",
  "scope": "Read",
  "token_type": "Bearer"
}
Previous1. Request DAR ID IdentityNext3. Refresh Access Token

Last updated 4 months ago