Documentation Index
Fetch the complete documentation index at: https://docs-staging.auth0-mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
POST /oauth/device/code
このフローは、入力制限されたデバイスがAPIにアクセスするためにデザインされています。このエンドポイントを使用して、ユーザーがデバイスを認可できるようにするデバイスコードを取得します。
要求例
POST https://${account.namespace}/oauth/device/code
Content-Type: application/x-www-form-urlencoded
client_id=${account.clientId}&scope=SCOPE&audience=API_IDENTIFIER
応答値
| 値 | 説明 |
|---|
device_code | デバイスの一意のコード。 |
user_code | デバイスを認可するためにユーザーが入力しなければならないコード。 |
verification_uri | デバイスを認可するためにユーザーがアクセスすべきURL。 |
verification_uri_complete | 簡単にアクセスできるようユーザーコードを含む完全なURL。 |
expires_in | デバイスおよびユーザーコードの有効期間の秒数。 |
interval | トークンを要求するポーリング間隔の秒数。 |
- リフレッシュトークンを取得するために
offline_accessをscopeに含めます。
- 返されたデバイスコードを使用して、トークンエンドポイントからのアクセストークンを要求します。
トークン要求の例
POST https://${account.namespace}/oauth/token
Content-Type: application/x-www-form-urlencoded
client_id=${account.clientId}&device_code=YOUR_DEVICE_CODE&grant_type=urn:ietf:params:oauth:grant-type:device_code
200
要求が成功するとアクセストークンを返します。
HTTP/1.1 200 OK
Content-Type: application/json
{
"access_token": "eyJz93a...k4laUWw",
"id_token": "eyJ...0NE",
"refresh_token": "eyJ...MoQ",
"expires_in": 86400,
"token_type": "Bearer"
}
エラー応答
HTTP/1.1 403 Forbidden
Content-Type: application/json
{ "error": "authorization_pending", "error_description": "User has yet to authorize device code." }
HTTP/1.1 429 Too Many Requests
Content-Type: application/json
{ "error": "slow_down", "error_description": "You are polling faster than the specified interval of 5 seconds." }
HTTP/1.1 403 Forbidden
Content-Type: application/json
{ "error": "access_denied", "error_description": "User cancelled the confirmation prompt." }
詳しく学ぶ
Parameters
アクセスしたいターゲットAPIの一意の識別子です。
Response
| Status | Description |
|---|
| 200 | デバイスおよびユーザーコードを返します。 |