OAuthアクセストークンを発行する

OAuth

アクセストークンを発行する

client_credentials、authorization_code、refresh_token を 3600 秒有効なトークンに交換します。

POSThttps://api.sofia-post.com/api/v1/oauth/token

ボディ

application/x-www-form-urlencoded, application/json

  • grant_typestring必須

    交換するグラント:client_credentials、authorization_code、または refresh_token

    使用できる値: client_credentialsauthorization_coderefresh_token

  • client_idstring必須

    クライアントアプリケーションの ID

  • client_secretstring

    機密クライアントのシークレット(client_secret_post)。または Authorization: Basic ヘッダー(client_secret_basic)で渡し、両方は使えません。パブリッククライアントでは不要です

  • scopestring

    要求するスコープ。スペース区切り。省略するとグラントのすべて

  • workspace_idstring

    トークンが操作する Workspace。client_credentials でアプリケーションが複数を持つ場合は必須、1 つの場合は任意です

  • codestring

    authorization_code:リダイレクト先で受け取ったコード

  • code_verifierstring

    authorization_code:PKCE ベリファイア(RFC 7636)

  • redirect_uristring

    authorization_code:認可時と同じリダイレクト先

  • refresh_tokenstring

    refresh_token:リフレッシュトークン(1 回限り)

レスポンス

200application/json

アクセストークン。refresh_token は offline_access が許可された場合のみ含まれます。

  • access_tokenstring必須

    不透明なアクセストークン

  • token_typestring必須

    常に Bearer

    使用できる値: Bearer

  • expires_innumber必須

    有効期間(秒)

  • scopestring必須

    許可されたスコープ。スペース区切り

  • refresh_tokenstring

    offline_access が許可された場合の authorization_code と refresh_token のみ。1 回限りで、交換のたびに更新されます

400

invalid_request、invalid_grant、unsupported_grant_type、invalid_scope、unauthorized_client。

401

invalid_client:未知のクライアント、シークレットの誤りまたは欠落、または失効したアプリケーション。