ray*_*.ng 6 active-directory azure oauth-2.0
我们遵循 Microsoft 代码授权流程的 OAuth2 的 v2,如下所述,
https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow
我们在微软Azure下的App Register创建了一个应用后,尝试从下面的url获取代码
https://login.microsoftonline.com/concept4.net/oauth2/v2.0/authorize?client_id= &response_type=code&redirect_uri= https://postman-echo.com/get&response_mode=query&scope=profile%20openid%20offline_access%20https% 3A%2F%2Fgraph.microsoft.com%2Fuser.read&state=skip_get_token2&prompt=consent
然后我们得到以下错误
{"error":"invalid_grant","error_description":"AADSTS65001: 用户或管理员未同意使用 ID 为“c4app2019”的应用程序。为此用户和资源发送交互式授权请求。\r\ n跟踪 ID:46424a2f-a3a2-45da-8902-888f5ca61c00\r\n关联 ID:49d0a6ad-e158-4bc9-97b8-a6391c6470bb\r\n时间戳:205016:2016:20119 ],"timestamp":"2019-12-11 07:51:31Z","trace_id":"46424a2f-a3a2-45da-8902-888f5ca61c00","correlation_id":"49d0a6ad-e18bc964000 ,"suberror":"consent_required"}
知道我们需要授予应用程序什么权限吗?
我无法在我这边重现您的问题。以下是我的步骤供您参考。
1.使用User.Read
和profile
权限创建应用程序。
2.由于我添加的权限不需要管理员同意,所以我可以在第一次登录时同意。
https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?
client_id=59437d85-46f8-409c-8211-b3db91a8b0e5
&response_type=code
&redirect_uri=http://localhost
&response_mode=query
&scope=https://graph.microsoft.com/User.Read
&state=12345
Run Code Online (Sandbox Code Playgroud)
3.使用我在step2中得到的代码获取token
要定位您的问题,请提供类似步骤 2(应用注册->您的应用程序->API 权限)的屏幕截图。以及用于获取代码/令牌的范围的价值。
归档时间: |
|
查看次数: |
17419 次 |
最近记录: |