测试已测试 | ✓ |
语言语言 | Obj-CObjective C |
许可 | MIT |
发布上次发布 | 2017年1月 |
由 Hernan Zalazar 维护。
依赖项 | |
Google/SignIn | ~> 3.0.0 |
Lock/Core | ~> 1.27 |
Auth0 是一个身份验证中介,支持社交身份提供者和企业身份提供者,如活动目录、LDAP、Google Apps 和 Salesforce。
Lock-Google 可帮助您与 Google iOS SDK 和 Lock 集成本地登录
iOS 7+
Lock-Google 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile
如果您在与 Podfile
中的 uses_frameworks!
标志一起使用 CocoaPods 时,添加 Lock-Google 可能会导致 CocoaPods 失败,因为 Google SignIn 库作为静态库发行。针对此情况的一个变通方法是将以下文件添加到您的项目中
并将 GoogleSignIn 库添加到您的项目或 Podfile
中,如下所示
pod 'Google/SignIn', '~> 1.0'
为了使用 Google API,您需要在 Google 开发者控制台 中注册您的 iOS 应用程序并获取您的 clientId。我们建议按照 此向导 进行动作,并下载在最后生成的文件 GoogleServices-Info.plist
将该文件添加到您的应用目标中,最后一步是注册两个用于您应用程序的自定义 URL。
第一个 URL 应该有一个与您的应用程序 Bundle 标识符相同的方案,另一个应该是您 Google clientId 的反向,如果您的 clientId 是 CLIENTID.apps.googleusercontent.com
,方案将是 com.googleusercontent.apps.CLIENTID
此最后一个值可以在
GoogleServices-Info.plist
下的REVERSED_CLIENT_ID
键中找到。有关更多信息,请参阅 Google 的 文档
如果您还有一个 Web 应用程序,并在 Auth0 中配置了 Google clientID 及其密钥,您需要在 Auth0 连接中将其移动应用程序的 Google clientID 加入白名单。使用您的移动端 Google clientID,访问 社交连接,选择 Google 并将 clientID 添加到名为 允许的移动端 Client ID
的字段中
只需创建一个新的 A0GoogleAuthenticator
实例
A0GoogleAuthenticator *google = [A0GoogleAuthenticator newAuthenticator];
let google = A0GoogleAuthenticator.newAuthenticator()
并将其与您的 A0Lock
实例注册
A0Lock *lock = //Get your A0Lock instance
[lock registerAuthenticators:@[google]];
let lock:A0Lock = //Get your A0Lock instance
lock.registerAuthenticators([google])
创建和注册
A0GoogleAuthenticator
的好地方是AppDelegate
。
A0GoogleAuthenticator *google = [A0GoogleAuthenticator newAuthenticatorWithScopes:@[@"scope1", @"scope2"]];
let google = A0GoogleAuthenticator.newAuthenticatorWithScopes(["scope1", "scope2"])
A0GoogleAuthenticator *google = [A0GoogleAuthenticator newAuthenticatorForConnectionName:@"my-google-connection"];
let google = A0GoogleAuthenticator.newAuthenticatorForConnectionName("my-google-connection")
有关 LockGoogle API 的更多信息,请参阅 CocoaDocs。
如果您发现了错误或有功能请求,请在本存储库的问题部分进行报告。请不要在公开的 GitHub 问题上报告安全问题。有关披露安全问题的程序,请参阅 负责任的披露计划。
Auth0 可帮助您
Lock-Google 在 MIT 许可下可用。请参阅LICENSE 文件获取更多信息。