これは OAuth 2.0 の認証トークンを取得するための REST サービスです。
POST
https://<domain>/<virtual_directory>
/oauth/access_token
client_id: アプリケーションのクライアント ID。
grant_type: 認証タイプ名
scope: アクセスするユーザーアカウントの適用範囲。使用可能な適用範囲を確認してください:
OAuth ユーザーの適用範囲
username: アクセスするアカウントのユーザー名。
password: アクセスするアカウントのパスワード。
&addstring = "client_id=be47d883307446b4b93fea47f9264f88&grant_type=GAMLocal&scope=gam_user_data&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 // &httpstatus は Numeric(X.0) 変数として定義される(X は 4 より大きく、9 以下)。
&result = &httpclient.ToString() //&result は LongVarChar 変数として定義される。
{
"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
https://<domain>/<virtual_directory>
/oauth/access_token
第 1 ステップ
client_id: アプリケーションのクライアント ID。
grant_type: 認証タイプ名
scope: アクセスするユーザーアカウントの適用範囲。使用可能な適用範囲を確認してください:
OAuth ユーザーの適用範囲
username: アクセスするアカウントのユーザー名。
password: アクセスするアカウントのパスワード。
additional_Parameters: OTPStep と UseTwoFactorAuthentication の両方が必要。
&addstring = 'client_id=be47d883307446b4b93fea47f9264f88&grant_type=GAMLocal&scope=gam_user_data&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 //&httpstatus は Numeric(X.0) 変数として定義され(X は 4 より大きく、9 以下)。
&result = &httpclient.ToString() //&result は LongVarChar 変数として定義される。
第 1 ステップの応答
第 1 ステップがステータスコード 202 とエラー 410 を返します:
{
"error": {
"code": "410",
"message": "To enter app, the second authentication factor must be validated."
}
}
第 2 ステップ
client_id: アプリケーションのクライアント ID。
grant_type: 認証タイプ名
scope: アクセスするユーザーアカウントの適用範囲。使用可能な適用範囲を確認してください:
OAuth ユーザーの適用範囲
username: アクセスするアカウントのユーザー名。
password=OTP_Value.
additional_Parameters: OTPStep と UseTwoFactorAuthentication の両方が必要。
&addstring = 'client_id=be47d883307446b4b93fea47f9264f88&grant_type=GAMLocal&scope=gam_user_data&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 //&httpstatus は Numeric(X.0) 変数として定義され(X は 4 より大きく、9 以下)。
&result = &httpclient.ToString() //&result は LongVarChar 変数として定義される。
第 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
http://<domain>/<virtual_directory>
/oauth/access_token
第 1 ステップ
client_id: アプリケーションのクライアント ID。
grant_type: 認証タイプ名
scope: アクセスするユーザーアカウントの適用範囲。使用可能な適用範囲を確認してください:
OAuth ユーザーの適用範囲
username: アクセスするアカウントのユーザー名。
password: アクセスするアカウントのパスワード。
&addstring = 'client_id=be47d883307446b4b93fea47f9264f88&grant_type=GAMLocal&scope=gam_user_data&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 //&httpstatus は Numeric(X.0) 変数として定義される(X は 4 より大きく、9 以下)。
&result = &httpclient.ToString() //&result は LongVarChar 変数として定義される。
第 1 ステップの応答
{
"error": {
"code": "400",
"message": "An email was sent with your access code"
}
}
client_id: アプリケーションのクライアント ID。
grant_type: 認証タイプ名
scope: アクセスするユーザーアカウントの適用範囲。使用可能な適用範囲を確認してください:
OAuth ユーザーの適用範囲
username: アクセスするアカウントのユーザー名。
password=OTP_Value.
&addstring = 'client_id=be47d883307446b4b93fea47f9264f88&grant_type=GAMLocal&scope=gam_user_data&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 //&httpstatus は Numeric(X.0) 変数として定義される(X は 4 より大きく、9 以下)
&result = &httpclient.ToString() //&result は LongVarchar データタイプに基づく変数。
第 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"
}