带有Auth0的XCTestCase:如何解除安全警报“XXXX”想要使用“auth0.com”登录

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了带有Auth0的XCTestCase:如何解除安全警报“XXXX”想要使用“auth0.com”登录相关的知识,希望对你有一定的参考价值。

所以最近Apple推出了这个提示:“XXXX”想要使用“auth0.com”登录其中“XXXX”是ios应用程序名称。

enter image description here

当Auth0用户点击“使用Google登录”或“使用Facebook登录”时,会出现此警报/对话框。这一切都很好但是在运行IOS UI测试时,当使用通常的解除系统对话框的方式时,此对话框不会消失:

func doUserLogin(_ app: XCUIApplication) {

    app.staticTexts["notLoggedInActivelabel"].tap()
    // this will bring up oauth0 login window in ios

    // setup a handler to dismiss the system alert
    let handler = self.addUIInterruptionMonitor (withDescription: "allow oauth") { (alert) -> Bool in
        // code should come here where the dialog is presented, 
        // but it never does ....   
        alert.buttons["Continue"].tap() // click Continue Button 
        return true
    }

    // click the login with GOOGLE button. This brings up dialog “XXXX” Wants to Use “auth0.com” to Login
    app.scrollViews.otherElements.buttons["LOG IN WITH GOOGLE"].tap()

    // this step is required when using addUIInterruptionMonitor
    app.tap()

    removeUIInterruptionMonitor(handler)
}

这对我来说很有意义:这是Apple为了提高安全性而引入的安全系统对话框。在代码中容易被忽略会破坏目的。 但是,有人知道是否可以在XCTestCase中关闭此对话框?

以上是关于带有Auth0的XCTestCase:如何解除安全警报“XXXX”想要使用“auth0.com”登录的主要内容,如果未能解决你的问题,请参考以下文章

带有 Auth0 的 Angular2,我需要隐藏我的 ClientID 和域吗?

如何安全地保存从 auth0 登录收到的 JWT 令牌(nodejs express)

你应该如何存储访问令牌?

带有自定义登录页面的 Auth0 授权代码流

Node.js 如何读取带有 HTTP 地址元素的 JSON

从 API 中访问 Auth0 登录用户?