我们正在outlook添加中实现SSO。让我们假设,这里有两个简单的租户。
房客Tenant
我们增加了客户租户的用户作为客人在家庭租户。因此,我们可以管理具有一定可访问性的来宾用户。
我们已经创建了多租户应用程序注册在家庭租户,以获得用户同意和认证客户租户。我们已经将应用程序(客户端) id和应用程序id uri放在Outlook中,如下所示。
</OfficeApp>
...
...
<WebApplicationInfo>
<Id>928cd908-multi-tenant-application-id</Id>
<Resource>api://company-domain.com/928cd908-multi-tenant-application-id</Resource>
<Scopes>
<Scope>Files.Read.All</Scope>
<Scope>offline_access</Scope>
<Scope>openid</Scope>
<Scope>profile</Scope>
</Scopes>
</WebApplicationInfo>
</VersionOverrides>
</VersionOverrides>
</OfficeApp>我们假设之前已经同意了,
为了做SSO,我遵循以下步骤,
客户Tenant.
。
POST /2e627697-home-tenant-ad-id/oauth2/v2.0/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer
&client_id=928cd908-multi-tenant-application-id
&client_secret=.m_7Qxxx
&assertion=eyJ0eXAiOiJKV1Q-customer-tenant-ad-token
&requested_token_use=on_behalf_of
&scope=api://company-domain.com/928cd908-multi-tenant-application-id/access_as_user openid由于客户租户的用户以guest.
到目前为止,问题是,
如果我为来宾用户启用了每个用户的MFA,那么当我代表服务器.执行请求时,就会出现以下错误。
{
"error": "invalid_grant",
"error_description": "AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access '928cd908-multi-tenant-application-id'.\r\nTrace ID: 706875e8-bfe7-44b8-a9f9-402b1f4a2201\r\nCorrelation ID: 8a4bde4c-9222-4aa0-a4d6-cd0748ff3816\r\nTimestamp: 2022-06-29 18:00:31Z",
"error_codes": [
50076
],
"timestamp": "2022-06-29 18:00:31Z",
"trace_id": "706875e8-bfe7-44b8-a9f9-402b1f4a2201",
"correlation_id": "8a4bde4c-9222-4aa0-a4d6-cd0748ff3816",
"error_uri": "https://login.microsoftonline.com/error?code=50076",
"suberror": "basic_action"
}有两个选项可以进行用户交互,
备选案文1
通过代表服务器请求将Officejs.auth.getAccessToken.
const authorizeUrl =
`https://login.microsoftonline.com/2e627697-home-tenant-ad-id/oauth2/v2.0/authorize?client_id=928cd908-multi-tenant-application-id
&response_type=id_token+token
&redirect_uri=https://company-domain.com/928cd908-multi-tenant-application-id
&scope=openid api://company-domain.com/928cd908-multi-tenant-application-id/access_as_user
&response_mode=fragment
&state=12345
&nonce=678910`
window.open(authorizeUrl)在MFA completed.
备选案文2
Officejs.auth.getAccessToken.
的MFA后获得客户租户令牌
问题
的
发布于 2022-07-26 01:35:44
为了确保MFA得到满足,使用MS图返回的消息作为Office.AuthOptions.authChallenge值。例如。
let exchangeResponse = await getGraphToken(bootstrapToken);
await Officejs.auth.getAccessToken({
authChallenge: exchangeResponse.claims
});https://stackoverflow.com/questions/72839954
复制相似问题