使用 keyclock 进行团队静默身份验证

时间:2021-04-08 06:32:02

标签: single-sign-on keycloak microsoft-teams

我通过使用团队选项卡静默身份验证从活动目录中获取令牌 https://docs.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/authentication/auth-tab-aad

现在如何让 keyclock 身份提供者签署该令牌

1 个答案:

答案 0 :(得分:0)

对于任何 OAuth 提供商,您都可以按照 Tab Authentication documentation 中提到的步骤进行操作。您可以重定向到您的身份验证提供程序以完成登录流程,而不是重定向到 https://login.microsoftonline.com/

  1. 使用 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);
     }
    

    });

  2. 将用户重定向到 /tab-auth/start-page 中的身份验证提供程序登录页面

     let authorizeEndpoint = "Your OAth provider page link here";
     window.location.assign(authorizeEndpoint);
    
  3. 用户现在将被重定向以完成登录。

  4. 登录完成并收到令牌后,您需要调用 microsoftTeams.authentication.notifySuccess() 以完成登录流程(这会关闭登录弹出窗口)。

如果您遇到任何问题,请告诉我们。 enter image description here