WebAuthentication
示例
要运行示例项目,请首先从仓库克隆项目,然后在 Example 目录下运行 pod install
将值替换为构建有效的 AuthConfiguration 以供您的服务使用,然后运行。
安装
- SPM
- CocoaPods
pod 'WebAuthentication'
使用方法
使用相应的参数创建 AuthConfiguration 实例。
let config = AuthConfiguration(
authCallbackURLScheme: ProfileConstants.authURLScheme,
authCallbackTokenQueryParamName: ProfileConstants.authTokenQueryName,
authStatusChangedNotificationName: Notifications.authStatusChanged,
authStatusChangedNotificationInfo: ProfileConstants.authTokenQueryName)
使用它来实例化一个 WebAuthentication。
let authenticator = WebAuthentication(configuration: authConfig)
调用显示方法,传入一个将作为登录流程演示者的 UIViewController。
authenticator?.display(url, from: viewController!, completion: { _ })
重要: 如果您的应用支持 iOS 12 的旧版本,您需要在 AppDelegate 中处理服务回调并推断令牌。
application(_: , open url:, options _: ) -> Bool
作者
catchakos, [邮箱地址隐藏]
许可证
WebAuthentication可在MIT许可证下使用。有关更多信息,请参阅LICENSE文件。