メインコンテンツへスキップ

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_accessscopeに含めます。
  • 返されたデバイスコードを使用して、トークンエンドポイントからのアクセストークンを要求します。

トークン要求の例

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

client_id
string
アプリケーションのIDです。
scope
string
認可を要求するスコープです。
audience
string
アクセスしたいターゲットAPIの一意の識別子です。

Response

StatusDescription
200デバイスおよびユーザーコードを返します。