Ir al contenido

OAuth 2.0 Implementation

Esta página aún no está disponible en tu idioma.

OAuth 2.0 allows your application to access the API on behalf of users without handling their credentials.

Direct users to the authorization endpoint:

https://auth.acme.com/oauth/authorize?
client_id=YOUR_CLIENT_ID&
redirect_uri=https://yourapp.com/callback&
response_type=code&
scope=read:users write:users&
state=random_state_string

After authorization, users are redirected to your redirect_uri with a code:

https://yourapp.com/callback?code=AUTH_CODE&state=random_state_string
Terminal window
curl -X POST "https://auth.acme.com/oauth/token" \
-H "Content-Type: application/json" \
-d '{
"grant_type": "authorization_code",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"code": "AUTH_CODE",
"redirect_uri": "https://yourapp.com/callback"
}'

Response:

{
"access_token": "oauth_abc123...",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "refresh_xyz789..."
}
Terminal window
curl -X POST "https://auth.acme.com/oauth/token" \
-d "grant_type=refresh_token&refresh_token=refresh_xyz789..."
ScopeDescription
read:usersRead user profiles
write:usersUpdate user profiles
read:webhooksView webhook configurations
write:webhooksManage webhooks