我在 Azure AD 中添加了 api 权限,但是当我获得令牌并在 jwt.ms 中显示它时,范围字段没有改变

I added api permerssions in Azure AD, but when I get the token,and showed it in jwt.ms, the scopes field doesn't change

无论我在 Azure 活动目录中为我的应用程序添加多少 api 权限,都只有默认的四个范围:"offline_access openid profile User.Read".

我添加了一些api权限,比如"Calendars.Read",但是token总是显示在jwt.ms如下。

    "scp": "offline_access openid profile User.Read",

但是我加了api权限后,我觉得应该是:

  "scp": "offline_access openid profile User.Read Calendars.Read Calendars.ReadWrite"

您需要再次同意。您可以通过 url 请求强制用户同意,或者只需单击 Azure 门户中的 'grant admin consent button'。看我的回答.

https://login.microsoftonline.com/{tenant}/oauth2/authorize? client_id={your_client_id} &response_type=code &response_mode=query &resource=https://graph.microsoft.com &state=12345 &prompt=consent