使用Auth0.swift WebAuth0设置初始屏幕

时间:2018-07-09 23:29:05

标签: swift auth0

我找不到找到Auth0对话框时要显示哪个屏幕的方法。

此特定用例https://auth0.com/docs/libraries/lock-ios/v2/configuration#initialscreen的锁SDK具有withOptions方法和一个initialScreen选项,但是WebAuth变体似乎没有任何内容。

https://auth0.com/docs/libraries/lock-ios/v1/sending-authentication-parameters看起来很有希望,但实际上与UI无关。

代码相当简单:

Auth0
  .webAuth(clientId: clientId, domain: domain)
  .scope("openid offline_access")
  .audience(audienceURL)
  .start { result in
    // react on the result...
  }

使用Swift 4.2,Auth0 1.0

1 个答案:

答案 0 :(得分:2)

到目前为止,我仅在Web项目中使用过Auth0,但是,请不要在此处混淆Auth0的Lock,SDK和API的概念,这一点非常重要。

虽然Lock使用了已经实现且很难定制的Auth0默认视图,但包含WebAuth的SDK可以通过定义Auth0帐户中的选项并将其与http请求一起发送来广泛地定制视图。有关更多信息,请参见Auth0 - Choose Technology

我建议您遵循Auth0 Universal Login方法。使用custom options创建自定义模板,然后使用WebAuth将这些选项与您的请求一起发送。作为指导,您可以遵循此Tutorial - Auth0 QuickStart iOS Login