我无法在政府云租户上获取 Azure Oauth2 授权令牌。我不断收到以下错误响应:
{
"error": "invalid_grant",
"error_description": "AADSTS50126: Invalid username or password.rnTrace ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxrnCorrelation ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxrnTimestamp: 2019-09-15 00:00:00Z",
"error_codes": [
50126
],
"timestamp": "2019-09-15 00:00:00Z",
"trace_id": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"correlation_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"error_uri": "https://login.microsoftonline.com/error?code=50126"
}
我在电话后使用以下信息:
End Point:
https://login.microsoftonline.com/<Tenant Id>/oauth2/v2.0/token
Headers:
Content-Type : application/x-www-form-urlencoded
Accept: application/json
Body:
client_id : <client id>
client_secret: <client secret>
grant_type: password
username: <username>
password: <password>
scope: https://graph.microsoft.com/.default
非常接近,但您没有使用正确的端点,请尝试使用以下命令:
https://login.microsoftonline.com/{TenantID/DirectoryID}/oauth2/token
与
https://login.microsoftonline.com/<Tenant Id>/oauth2/v2.0/token