我如何使用Azure B2C服务返回的IDP_ACCESS_TOKEN

发布于 2025-02-10 18:40:28 字数 224 浏览 1 评论 0原文

我已经设置了Azure AD B2C服务,以注册/登录我的用户,并使用了第三方身份提供商Google和Microsoft。成功登录后,我将获得IDP_ACCESS_TOKEN 从B2C服务返回。我可以使用这个令牌直接连接到Google和Microsoft API 正如Azure Docs提到的那样,该令牌由身份提供者发行,并由B2C服务索赔返回。但是IDP_ACCESS_TOKEN似乎并不是有效的访问令牌,并且其中不包含任何索赔。

I have setup a azure ad b2c service to sign up/ sign in my users and have used third party identity providers google and microsoft. After successful logging in, I get idp_access_token
back from b2c service. Can I use this token to directly connect to google and microsoft api
as azure docs mention, this token is issued by identity providers and returned as claims by b2c service. But the idp_access_token doesn't seem to be a valid access token and no claims are included in it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岛徒 2025-02-17 18:40:28

要获得有效的“ IDP_ACCESS_TOKEN”,请检查是否必须在OpenID身份提供商配置的Metaurl中设置“ v2.0”:

https://xxx.b2clogin.com/xxxx.onmicrosoft.com/v2.0/.well-known/openid-configuration

我们可能无法编辑已经创建的元数据。 v2.0“ Metaurl。

当用户签名具有身份提供商(例如Google或Facebook)时,您的应用将获得身份提供商的访问令牌,以azure ad b2c令牌传递。 此IDP_ACCESS_TOKEN可以使用IDP_ACCESS_TOKEN,可以致电身份提供商的API em>,例如Facebook Graph api ie; 通常使用嵌入式IDP访问令牌来调用IDP主机的服务。有关详细信息,请参见通过用户流到Azure Active Directory B2C中的应用程序传递访问令牌。

参考: techcommunity.microsoft.com blog

注意

  1. Azure AD B2C支持传递oauth 2.0身份提供者的访问令牌,其中包括Facebook和Google。 对于所有其他身份提供商,索赔被返回空白。
  2. 即使IDP_ACCESS_TOKEN索赔是有效的JWT,也不能用于访问Microsoft图形或其他其他范围。通常
    嵌入式IDP访问令牌用于调用IDP的服务
    主持人。但是Microsoft Graph数据托管在Azure AD中,而不是在
    Microsoft帐户方。


您可以将此Microsoft文档检查到 使用Azure Active Directory B2C 使用Azure Active Directory B2C < /a>

参考:

  1. 使用Azure B2C登录访问Microsoft Graph是Social Login是Microsoft帐户

To get a valid "idp_access_token", please check if you have to set "v2.0" in the metaurl of the OpenId Identity Provider Configuration:

https://xxx.b2clogin.com/xxxx.onmicrosoft.com/v2.0/.well-known/openid-configuration

We maynot be able to edit metadeta url of already created one .So try create new one with "v2.0" in metaurl.

When a user signs with identity provider, like google or Facebook, your app gets the identity provider's access token passed in Azure AD B2C token.This idp_access_token can be used call the identity provider’s API, such as the Facebook Graph API i.e;Usually the embedded IdP access token is used to call the services that the IdP hosts. For details see Pass an access token through a user flow to your application in Azure Active Directory B2C.

Reference: techcommunity.microsoft.com blog

Note :

  1. Azure AD B2C supports passing the access token of OAuth 2.0 identity providers, which include Facebook and Google. For all other identity providers, the claim is returned blank.
  2. Even if idp_access_token claim is a valid JWT, it cannot be used to access Microsoft Graph or other additional scopes. As usually the
    embedded IdP access token is used to call the services that the IdP
    hosts. But Microsoft Graph data is hosted in Azure AD and not in
    Microsoft Account side.

You can check this microsoft document to Set up sign-up and sign-in with a Facebook account using Azure Active Directory B2C or with a Google account using Azure Active Directory B2C

References:

  1. Using Azure B2C login to access Microsoft Graph is the social login is a Microsoft account
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文