Lock-Google 3.0.0

Lock-Google 3.0.0

测试已测试
语言语言 Obj-CObjective C
许可 MIT
发布上次发布2017年1月

Hernan Zalazar 维护。



 
依赖项
Google/SignIn~> 3.0.0
Lock/Core~> 1.27
 

  • Auth0 和 Hernan Zalazar

Auth0 是一个身份验证中介,支持社交身份提供者和企业身份提供者,如活动目录、LDAP、Google Apps 和 Salesforce。

Lock-Google 可帮助您与 Google iOS SDKLock 集成本地登录

需求

iOS 7+

安装

Lock-Google 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile

Swift 和框架

如果您在与 Podfile 中的 uses_frameworks! 标志一起使用 CocoaPods 时,添加 Lock-Google 可能会导致 CocoaPods 失败,因为 Google SignIn 库作为静态库发行。针对此情况的一个变通方法是将以下文件添加到您的项目中

并将 GoogleSignIn 库添加到您的项目或 Podfile 中,如下所示

pod 'Google/SignIn', '~> 1.0'

在您开始使用 Lock-Google 之前

为了使用 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 的 文档

.Auth0 与多个 Google clientID 连接(Web & 移动端)

如果您还有一个 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"])

自定义 Google 连接

A0GoogleAuthenticator *google = [A0GoogleAuthenticator newAuthenticatorForConnectionName:@"my-google-connection"];
let google = A0GoogleAuthenticator.newAuthenticatorForConnectionName("my-google-connection")

有关 LockGoogle API 的更多信息,请参阅 CocoaDocs。

问题报告

如果您发现了错误或有功能请求,请在本存储库的问题部分进行报告。请不要在公开的 GitHub 问题上报告安全问题。有关披露安全问题的程序,请参阅 负责任的披露计划

什么是 Auth0?

Auth0 可帮助您

  • 通过多个身份提供者添加身份验证,例如 Google、Facebook、Microsoft 账户、LinkedIn、GitHub、Twitter、Box、Salesforce 等社交,或企业身份系统如 Windows Azure AD、Google Apps、Active Directory、ADFS 或任何 SAML 身份提供者
  • 通过更传统的 用户名密码数据库添加身份验证。
  • 支持将同一用户的不同用户帐户 关联
  • 支持生成签名 Json Web Tokens 来调用您的 API 并安全地 流转用户身份
  • 分析用户如何、何时何地登录的情况。
  • 通过 JavaScript 规则从其他来源提取数据并将其添加到用户资料中。

在 Auth0 中创建免费账户

  1. 访问 Auth0 并点击注册。
  2. 使用 Google、GitHub 或 Microsoft 账户登录。

作者

Auth0

许可

Lock-Google 在 MIT 许可下可用。请参阅LICENSE 文件获取更多信息。