gpt4 book ai didi

使用 Auth API 的 SPA 的 Azure B2C 隐式流为 openid 范围提供无效 token

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

我已将应用程序设置为使用 Azure B2C 的隐式流 token 策略,通过 URI 中的注册后/登录登录为我提供 token 。这工作正常,并且 token 可以顺利授权。

但是,客户端是 SPA,因此当 token 过期时,Microsoft 建议的记录解决方法是使用 iframe 来调用 authorize 端点,如下所述:Get Access Tokens

https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?client_id={my_client_id}&response_type=token&redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F&scope=openid&response_mode=fragment&state=12345&nonce=678910&prompt=none&domain_hint=organizations&<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6804070f0106370001061c5505111d1b0d1a2805110b070518090611460b0705" rel="noreferrer noopener nofollow">[email protected]</a>

不幸的是,如果我使用此端点的 openid 范围请求 id_token,实际返回的 token 不会通过我的 API 中的 B2C 进行授权。在解码器中检查 JWT token 还表明, token 本身看起来与 B2C 登录后给定的 token 不同。

我意识到此文档适用于 Azure Active Directory,并且 B2C doesn't support SPAs at this point ,但我之前从 Microsoft 代表那里听说这应该可行。

这真的不支持吗?如果没有,SPA 是否有任何解决方法?

最佳答案

Many modern apps have a single-page app front end written primarily in JavaScript. They often use a framework such as AngularJS, Ember.js, or Durandal. The generally available Azure AD service supports these apps by using the OAuth 2.0 implicit flow. However, this flow is not yet available in Azure AD B2C.

据目前文档所述,尚不支持该功能。如果希望Azure AD B2C支持该功能,可以从here投票.

关于使用 Auth API 的 SPA 的 Azure B2C 隐式流为 openid 范围提供无效 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40734512/

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