最近のアクセス:
Access_token GAM サービス

これは OAuth 2.0 の認証トークンを取得するための REST サービスです。

一要素認証を使用する場合

エンドポイント

POST  $ServerURL/oauth/gam/access_token

パラメーター

Client_id: アプリケーションのクライアント ID。
Grant_type: 認証タイプ名。
Scope: アクセスするユーザーアカウントの適用範囲。(FullControl または gam_user_info)
Username: アクセスするアカウントのユーザー名。
Password: アクセスするアカウントのパスワード。

&addstring = "client_id=be47d883307446b4b93fea47f9264f88&grant_type=GAMLocal&scope=FullControl+gam_user_info&username=test&password=test"

&getstring = &urlbase + "/oauth/access_token"  

&httpclient.AddHeader("Content-Type", "application/x-www-form-urlencoded")
&httpclient.AddString(&addstring)
&httpclient.Execute("POST", &getstring)

&httpstatus = &httpclient.StatusCode
&result = &httpclient.ToString()

応答

{    
     "access_token": "ae47229f-e133-42d1-87e0-c5ac59e51edf!a90817ee94932e905b6fada72bf83dbef4605e2bacbe850f6a684bb3a7b072a6860b2ee76d20d6",     
     "token_type": "Bearer",     
     "expires_in": 180,     
     "refresh_token": "001mebXeCSJY0Pb9nMsBoVIYAvbwAhbHw5FqK1e",     
     "scope": "FullControl+gam_user_info",     
     "user_guid": "eeb8bc39-b7dc-4169-8eb7-ffee95386876" 
}

二要素認証を使用する場合

エンドポイント

POST  $ServerURL/oauth/access_token

第 1 ステップ

Client_id: アプリケーションのクライアント ID。
Grant_type: 認証タイプ名
Scope: アクセスするユーザーアカウントの適用範囲。
Username: アクセスするアカウントのユーザー名。
Password: アクセスするアカウントのパスワード。
Additional_Parameters: OTPStep と UseTwoFactorAuthentication の両方が必要。 

&addstring = 'client_id=be47d883307446b4b93fea47f9264f88&grant_type=GAMLocal&scope=FullControl+gam_user_info&username=test&password=test&additional_parameters="AuthenticationTypeName":"Local","OTPStep":"1","Repository":"","UseTwoFactorAuthentication":"false","Properties": [ {} ] }'

&getstring = &urlbase + "/oauth/access_token"
&httpclient.AddHeader("Content-Type", "application/x-www-form-urlencoded")
&httpclient.AddString(&addstring)
&httpclient.Execute("POST", &getstring)

&httpstatus = &httpclient.StatusCode
&result = &httpclient.ToString()
第 1 ステップがステータスコード 202 とエラー 410 を返します:
{
   "error": {
       "code": "410",
       "message": "To enter app, the second authentication factor must be validated."
    }
}

第 2 ステップ

Client_id: アプリケーションのクライアント ID。
Grant_type: 認証タイプ名
Scope: アクセスするユーザーアカウントの適用範囲。
Username: アクセスするアカウントのユーザー名。
Password: OTP_Value
Additional_Parameters: OTPStep と UseTwoFactorAuthentication の両方が必要。 

&addstring = 'client_id=be47d883307446b4b93fea47f9264f88&grant_type=GAMLocal&scope=FullControl+gam_user_info&username=test&password=OTP_Value&additional_parameters="AuthenticationTypeName":"Local","OTPStep":"2","Repository":"","UseTwoFactorAuthentication":"true","Properties": [ {} ] }'

&getstring = &urlbase + "/oauth/access_token"
&httpclient.AddHeader("Content-Type", "application/x-www-form-urlencoded")
&httpclient.AddString(&addstring)
&httpclient.Execute("POST", &getstring)

&httpstatus = &httpclient.StatusCode
&result = &httpclient.ToString()
第 2 ステップの応答
{
    "access_token": "72fef4c4-bb13-418b-9eee-92cbc18ed846!9153eaf0277241ef38de08ea5a7adf47d08ed29144e90c2ab46da38bb02a441b21273ee3ac56e4",
    "token_type": "Bearer"
    "expires_in": 0,
    "refresh_token": "",
    "scope": "FullControl",
    "user_guid": "63d9f144-f4e1-4f9e-a49e-ba0a12892544"
}

ワンタイムパスワードを使用する場合

エンドポイント

POST  $ServerURL/oauth/access_token

第 1 ステップ

Client_id: アプリケーションのクライアント ID。
Grant_type: 認証タイプ名
Scope: アクセスするユーザーアカウントの適用範囲。
Username: アクセスするアカウントのユーザー名。
Password: アクセスするアカウントのパスワード。

&addstring = "client_id=be47d883307446b4b93fea47f9264f88&grant_type=GAMLocal&scope=FullControl+gam_user_info&username=test&password=test&additional_parameters="AuthenticationTypeName":"Local","Repository":"","Properties": [ {} ] }'

&getstring = &urlbase + "/oauth/access_token"
&httpclient.AddHeader("Content-Type", "application/x-www-form-urlencoded")
&httpclient.AddString(&addstring)
&httpclient.Execute("POST", &getstring)

&httpstatus = &httpclient.StatusCode
&result = &httpclient.ToString()

第 1 ステップがステータスコード 202 とエラー 400 を返します

{
   "error": {
       "code": "400",
       "message": "An email was sent with your access code"
    }
}

第 2 ステップ

Client_id: アプリケーションのクライアント ID。
Grant_type: 認証タイプ名
Scope: アクセスするユーザーアカウントの適用範囲。
Username: アクセスするアカウントのユーザー名。
Password: OTP_Value

&addstring = "client_id=be47d883307446b4b93fea47f9264f88&grant_type=GAMLocal&scope=FullControl+gam_user_info&username=test&password=OTP_Value&additional_parameters="AuthenticationTypeName":"Local","Repository":"","Properties": [ {} ] }'

&getstring = &urlbase + "/oauth/access_token"
&httpclient.AddHeader("Content-Type", "application/x-www-form-urlencoded")
&httpclient.AddString(&addstring)
&httpclient.Execute("POST", &getstring)

&httpstatus = &httpclient.StatusCode
&result = &httpclient.ToString()
第 2 ステップの応答
{
    "access_token": "72fef4c4-bb13-418b-9eee-92cbc18ed846!9153eaf0277241ef38de08ea5a7adf47d08ed29144e90c2ab46da38bb02a441b21273ee3ac56e4",
    "token_type": "Bearer"
    "expires_in": 0,
    "refresh_token": "",
    "scope": "FullControl",
    "user_guid": "63d9f144-f4e1-4f9e-a49e-ba0a12892544"
}


サブページ
Created: 20/12/14 21:41 by Admin Last update: 24/03/25 23:57 by Admin
カテゴリ
Powered by GXwiki 3.0