Apps connect to stores with the OAuth 2.0 authorization code flow. PKCE (S256) is supported and recommended.
- 1
Send the store owner to the consent screen
Keep the state value in the session and compare it on return (CSRF protection).
- 2
The store owner reviews and approves the permissions
Each requested scope is listed with its description. Approval installs the app.
- 3
Exchange the code for a token
The code is single-use and valid for 10 minutes. The request must be made server to server.
1. Authorization URL
https://panel.dznsoft.com/oauth/authorize
?client_id=dzn_ci_xxxxxxxxxxxxxxxxxxxxxxxx
&redirect_uri=https://your-app.com/oauth/callback
&scope=products.read orders.read
&state=RANDOM_SINGLE_USE_VALUE
&code_challenge=BASE64URL_SHA256_VERIFIER
&code_challenge_method=S256
2. Callback
https://your-app.com/oauth/callback?code=AbC123...&state=RANDOM_SINGLE_USE_VALUE&store_id=812
3. Token request — POST https://api.dznsoft.com/oauth/token
curl -X POST "https://api.dznsoft.com/oauth/token" \
-u "$DZN_CLIENT_ID:$DZN_CLIENT_SECRET" \
-d grant_type=authorization_code \
-d code="$CODE" \
-d redirect_uri="https://your-app.com/oauth/callback" \
-d code_verifier="$CODE_VERIFIER"
Response
{
"token_type": "Bearer",
"access_token": "dzn_at_…",
"expires_in": 3600,
"refresh_token": "dzn_rt_…",
"scope": "products.read orders.read",
"store_id": 812
}
Refreshing: when the access token expires, renew it with grant_type=refresh_token. Refresh tokens are single-use (rotation): every refresh returns a new pair. If a used refresh token is sent again, it’s treated as a leak and every token derived from the same authorization is revoked.
Refreshing a token
curl -X POST "https://api.dznsoft.com/oauth/token" \
-u "$DZN_CLIENT_ID:$DZN_CLIENT_SECRET" \
-d grant_type=refresh_token \
-d refresh_token="$DZN_REFRESH_TOKEN"
Revoking: send POST https://api.dznsoft.com/oauth/revoke with token in the body to revoke an access or refresh token (RFC 7009).