Microsoft Graph APIを使用してOffice 365メールを読み込もうとしています。私はAzure AD(V2ではない)を介して認証してトークンを得ることができますが、私が得る唯一の許可はUser.Readです。私はMail.Readが欲しい。MSグラフAPIを使用したAzure ADは、自分のアプリケーションMail.Readを許可できません。
Azureポータルの私のアプリケーション登録には、Mail.Read権限、API「Microsoft Graph」、権限「Read user mail」が含まれています。 /authorize
リクエストでは、resource
とscope
の両方を指定します。後者はhttps://graph.windows.net/mail.read
です。しかし、JSONのトークンが戻ってくると、"scope":"User.Read"
になります。 https://graph.microsoft.com/v1.0/me/messages
への要求は、エラー403を返しますが、https://graph.microsoft.com/v1.0/me/
は期待どおりに動作します。
私には何が欠けていますか?
EDIT:初期OAuthのURIは次のとおりです。
https://login.microsoftonline.com/common/oauth2/authorize?response_type=code&redirect_uri=https%3a%2f%2fredacted.com%2fgoblin%2fback.aspx&client_id=3b595e3f-aecf-4a8c-8ec3-309810d75783&response_mode=query&scope=https%3a%2f%2fgraph.windows.net%2fmail.read&resource=https%3a%2f%2fgraph.windows.net%2f
JSONは行く:
{
"token_type": "Bearer",
"scope": "User.Read",
"expires_in": "3599",
"ext_expires_in": "0",
"expires_on": "1494364932",
"not_before": "1494361032",
"resource": "https://graph.microsoft.com/",
"access_token": "redacted",
"refresh_token": "redacted",
"id_token": "redacted"
}
OAUTHワークフローを開始するために使用しているURIだけでなく、実際のJSON出力が返されますか? –