【问题标题】:Teams tab authentication团队选项卡身份验证
【发布时间】:2017-12-02 05:51:38
【问题描述】:

我正试图弄清楚如何使用microsoftTeams.authentication.authenticate() 函数,但我真的很困惑。当我调用该函数时,会在我的浏览器 (Chrome) 窗口中打开一个新选项卡,而不是在 Teams 本身中。这是正常行为吗?身份验证有效并重定向到我调用 microsoftTeams.authentication.notifySuccess() 函数的回调 url,但它不会返回到 microsoftTeams.authentication.authenticate() 成功回调(总是命中失败回调)。这是validDomains 的问题吗?我很迷茫。任何帮助都会很棒!谢谢。

microsoftTeams.authentication.authenticate({
    url: "/auth",
    width: 500,
    height: 500,
    successCallback: () => {
        alert("auth success")
        // Redirect to app
        window.location.href = "/app"
    },
    failureCallback: () => {
        alert("auth failure")
    }
})

【问题讨论】:

    标签: authentication microsoft-teams


    【解决方案1】:

    我想通了。

    我犯了一个错误,在页面加载时调用microsoftTeams.authentication.authenticate() 函数,而不是在某些用户交互(如登录按钮单击)时调用。

    参考:"Add UI to your configuration or content page to enable the user to sign in when necessary. You should not drive the authentication pop-up without user action, because this is likely to trigger the browser's pop-up blocker."

    【讨论】:

    • 我尝试了相同的流程,但即使我调用 microsoftTeams.authentication.notifySuccess("") 或 microsoftTeams.authentication.notifyFailure(""),弹出窗口也不会关闭。正如建议的那样,我在登录链接点击时这样做。但是,如果我单击关闭弹出窗口,则会调用失败回调。
    • 嗨@Ashutosh 你有没有解决过这个问题?经历同样的事情。
    • 嗨@AlexP,由于这已经超过 1 年了,我可能无法解决您的确切问题,但经过silent authentication doc之后我的问题得到了解决
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-14
    • 2018-01-27
    • 1970-01-01
    • 1970-01-01
    • 2019-10-26
    • 2019-02-22
    相关资源
    最近更新 更多