我通过使用团队选项卡静默身份验证从活动目录中获取令牌 https://docs.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/authentication/auth-tab-aad
现在如何让 keyclock 身份提供者签署该令牌
答案 0 :(得分:0)
对于任何 OAuth 提供商,您都可以按照 Tab Authentication documentation 中提到的步骤进行操作。您可以重定向到您的身份验证提供程序以完成登录流程,而不是重定向到 https://login.microsoftonline.com/
。
使用 SDK 方法打开身份验证弹出窗口。
microsoftTeams.authentication.authenticate({
url: window.location.origin + "/tab-auth/start-page",
width: 600,
height: 535,
successCallback: function (result) {
getUserProfile(result.accessToken);
},
failureCallback: function (reason) {
handleAuthError(reason);
}
});
将用户重定向到 /tab-auth/start-page
中的身份验证提供程序登录页面
let authorizeEndpoint = "Your OAth provider page link here";
window.location.assign(authorizeEndpoint);
用户现在将被重定向以完成登录。
登录完成并收到令牌后,您需要调用 microsoftTeams.authentication.notifySuccess()
以完成登录流程(这会关闭登录弹出窗口)。