gpt4 book ai didi

azure - OpenId 仅连接 token AAD

转载 作者:行者123 更新时间:2023-12-02 02:54:10 26 4
gpt4 key购买 nike

是否可以只从 AAD 获取 id_token?我有一个非常简单的情况,我的角度应用程序需要用户的用户名,并且我的 api 层是开放的。

我以为我可以将我的 clientid 和资源设置为 AAD 中我的 Angular 应用程序的 clientId,但我得到了:

"AADSTS65005 Invalid resource. The client has requested access to a resource which is not listed in the requested permissions in the client application registration"

这是在隐式授权流程中。

---编辑

例如,如果我发送此初始重定向来启动隐式授权:

https://login.microsoftonline.com/{{MY-TENANT-HERE}}/oauth2/authorize?response_type={{id_token}}&client_id={{CLIENTID-HERE}}&state={{STATE-HERE}}&redirect_uri={{REDIRECTURI-HERE}}&scope={{openid profile email}}&nonce={{nonce-here}}&resource={{CLIENTID-HERE}}

产生这个:

"AADSTS65005 Invalid resource. The client has requested access to a resource which is not listed in the requested permissions in the client application registration"

如果我不发送资源(即以下请求):

  https://login.microsoftonline.com/{{MY-TENANT-HERE}}/oauth2/authorize?response_type={{id_token}}&client_id={{CLIENTID-HERE}}&state={{STATE-HERE}}&redirect_uri={{REDIRECTURI-HERE}}&scope{{openid profile email}}&nonce={{nonce-here}}

我收到一条消息,指出需要资源。所以我的问题是,假设我没有后端,但我的前端需要知道用户是谁,AAD 中如何支持这一点?

最佳答案

出现此问题的原因是您的角度应用程序可能未向 Azure AD 注册,或者可能未应用正确的权限。

如果尚未这样做,请尝试在 Azure 门户中的正确租户下为 Angular 应用创建新的应用注册。使用访问 token 或 ID token 是访问用户配置文件的正确方法。

https://developer.microsoft.com/en-us/graph/docs/concepts/auth_overview

关于azure - OpenId 仅连接 token AAD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50377893/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com