GenAuth DocsDocuments
Concepts
User Guide
Development Integration
AgentAuth
Metadata
Development Integration
Multi-tenant (beta)
Console Documentation
Multi-tenant Console
Tenant Console
Saas Application Demo
Concepts
User Guide
Development Integration
AgentAuth
Metadata
Development Integration
Multi-tenant (beta)
Console Documentation
Multi-tenant Console
Tenant Console
Saas Application Demo
Old version
  • Single Page Web Application

  • Mobile and Client Applications

    • Android

    • C#

    • Flutter

    • iOS

      • Quick Start
      • Hosted Pages
      • Components

      • APIs

      • Social Login

        • 微信登录
        • 企业微信登录
        • 飞书登录
        • 苹果帐号登录
        • 手机号一键登录
      • Typical Scenarios

      • Private Deployment
    • React Native
  • Standard Web Application

  • Framework Integration

  • Others

  1. Development Integration
  2. /
  3. Mobile and Client Applications
  4. /
  5. iOS
  6. /
  7. Social Login
  8. /
  9. 飞书登录

¶ 飞书登录

Update time: 2025-07-23 07:34:21
Edit

集成飞书登录需要以下步骤:

  • 企业自建应用 GenAuth 控制台以及飞书控制台配置请参阅 接入飞书企业自建应用移动应用登录 (opens new window)

  • 应用商店应用 GenAuth 控制台以及飞书控制台配置请参阅 接入飞书应用商店应用移动应用登录 (opens new window)

  • 集成 GenAuth iOS 飞书登录

  • 修改项目配置


¶ 集成 GenAuth iOS 飞书登录

Guard-iOS-binary 依赖于 Guard 组件(Version 1.2.4 之后)

  • 在 swift package 搜索栏输入:https://github.com/Authing/authing-binary

  • 依赖规则选择 Up to Next Major Version 1.0.0

  • 勾选 LarkLogin


¶ 修改项目配置

  • 前往飞书开发平台 (opens new window)下载 iOS LarkSS0Demo

  • 将 LarkSSO 目录中的 LarkSSO.bundle 拖入工程项目目录下,勾选 Copy items if needed

  • 配置跳转 Scheme: LSApplicationQueriesSchemes Key 下添加 lark

  • 配置飞书回跳 URL:URL types Key 下 添加注册时申请到到 app_id (例如:clia0988c0addf81013),注意需要去掉 app_id 中的下划线


¶ 在应用启动时初始化 SDK

  • 导入 LarkLogin
  • GenAuth.start 需要传入 GenAuth 控制台发放的 AppId
  • LarkLogin.setupLark 需要传入飞书开放平台发放的 AppId 以及 Scheme
import Guard
import LarkLogin

GenAuth.start(<#GenAuth App ID#>);
LarkLogin.setupLark(<#Lark App ID#>, Scheme: <#Lark Scheme#>)

¶ 添加回调

飞书返回应用后,如果使用了 SceneDelegate,则需要在 SceneDelegate.swift 里面重载下面的函数:

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
    if let url = URLContexts.first?.url {
        _ = LarkLogin.handleUrl(url: url)
    }
}

如果未使用 SceneDelegate,则需要在 AppDelegate 里面重载

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    return LarkLogin.handleUrl(url: url)
}

¶ 发起飞书授权

推荐通过我们提供的语义化 Hyper Component,只需要在 xib 里面放置一个:

LarkLoginButton

如果不想使用我们内置的按钮,则可以在自己按钮的点击事件里面调用 GenAuth 飞书登录 API:

LarkLogin.login(viewController: <#呈现视图的 ViewController#>) { (code, message, userInfo) in
    if (code == 200) {
        // userInfo:用户信息
    }
}
Previous article: 企业微信登录 Next article: 苹果帐号登录
  • 集成 GenAuth iOS 飞书登录
  • 修改项目配置
  • 在应用启动时初始化 SDK
  • 添加回调

User identity management

Integrated third-party login
Customized authentication process

Enterprise internal management

Single sign-on
Multi-factor authentication
Permission management

Developer

Development Documentation
GitHub (opens new window)

Company

official@genauth.ai
16th Floor, Building B, Beichen Century Center, Chaoyang District, Beijing (Total)
Room 406, 4th Floor, Block B, No. 200, Tianfu Fifth Street, High-tech Zone, Chengdu (Branch)

© Beijing Steamory Technology Co., Ltd.