oauth-2.0 - microsoft oidc id token 的 oid 声明是否与我从 microsoft graph api 获得的 id 相同?

标签 oauth-2.0 azure-active-directory microsoft-graph-api openid-connect

About oid claim从 azureAD 的访问 token /ID token 解码:

.... This ID uniquely identifies the user across applications - two different applications signing in the same user will receive the same value in the oid claim. ... Note that if a single user exists in multiple tenants, the user will contain a different object ID in each tenant - they're considered different accounts, even though the user logs into each account with the same credentials. ...

About id从 microsoft graph api 的 /me 获取:

The unique identifier for the user.

以前,我的一个应用程序使用 id token 中的 oid 作为 azure 用户的 ID。 现在,我想出于相同的目的更新和使用图 api 的 id 。所以:

  • 这两个 id(oidid)是否相同?那么我可以用 id 替换 oid 吗?
  • /me 获取的 id 对于“每个租户”来说是否不同,如上面的 oid 描述?

最佳答案

是的,oid 和 id 应该相同,至少对于 AAD 用户来说是这样。

但您作为成员的每个 AAD 租户的情况都不同。它全局唯一标识特定的用户对象,每个用户对象在每个租户中都是独立的。

可以通过应用程序注册中的 token 配置 Blade 包含“主租户 oid”。 这将是用户在其主租户(即创建用户的租户)中的 oid。

关于oauth-2.0 - microsoft oidc id token 的 oid 声明是否与我从 microsoft graph api 获得的 id 相同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60170062/

相关文章:

javascript - 通过 Discord OAuth 传递字符串?

security - OAuth 2.0 公共(public)客户端模拟

java - 如何使用 ADAL JS 颁发的隐式授权 token 从 Web API 访问图形 API

azure - 如何修改 Azure Web 应用程序的 Azure AD B2C 登录/注册页面

microsoft-graph-api - Microsoft Graph API - 更新密码 - 权限不足,无法完成操作

从 facebook oauth 重定向时 django session 丢失

oauth-2.0 - 错误 : invalid_request device_id and device_name are required for private IP

azure - @azure/identity node.js 无法进行身份验证

azure-active-directory - Microsoft Graph API 间歇性错误 "Token not found: token is either invalid or expired"在重试后自行解决

azure - "User not found"用于具有客户端凭据身份验证流程的 Azure 企业应用安全组中的 Graph API 请求