FullAuthIOSClient 1.0.7

FullAuthIOSClient 1.0.7

测试已测试
语言语言 SwiftSwift
许可 MIT
发布最后发布2020年4月
SPM支持 SPM

karthiksathishvgs 维护。



  • Karthik samy

FullAuthIOSClient

Build Status Version License Platform

支持的操作

要求

  • iOS 10.0+
  • Xcode 11+
  • Swift 4.2+

最新版本

1.0.1 是当前最新版本。有关变更日志,请参阅发布

安装

FullAuthIOSClient 可通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 中

CocoaPods

pod "FullAuthIOSClient"

Swift Package Manager

FullAuthIOSClient 可通过 Swift Package Manager 获取。要安装它,只需将以下依赖项添加到您的 Package.swift

.package(url: "https://github.com/Adaptavant/fullauth-api-ios-client.git", from: "1.0.1")

请求访问令牌

fullAuth规范中支持几种请求访问令牌的流程,如下所述

通过提供必要的输入来创建一个 authService

let authService =  FullAuthOAuthService(appMode: AppMode.live, authDomain: "your auth domain":, clientId: "client-id", clientSecret: "client-secret")

使用资源所有者凭证

将资源所有者的用户名和密码作为请求的一部分提交,并在身份验证成功后颁发令牌。

do {
    try authService.requestAccessTokenForResourceCredentials("user-email-id", password: "password", scope: ["scope1", "scope2"], accessType: .OFFLINE, handler: { (error, errorResponse, accessToken) -> Void in
    // process full auth response
         })
    } catch let err {
             // handle error 
    }

使用谷歌访问令牌

通过传递有效的谷歌访问令牌请求 AccessToken。

 do {
     try authService.requestAccessTokenForGoogleToken(googleAccessToken: "googleToken", scope: ["scope1", "scope2"], accessType: .OFFLINE, handler: { (error, errorResponse, accessToken) in
                   // process the response
               })
    } catch let err {
             // handle the error 
    }

使用Facebook访问令牌

通过传递有效的Facebook访问令牌请求AccessToken。

do {
    try authService.requestAccessTokenForGoogleToken(faceBookAccessToken: "facebookToken", scope: ["scope1", "scope2"], accessType: .OFFLINE, handler: { (error, errorResponse, accessToken) in
                  // process the response
              })
   } catch let err {
            // handle the error 
   }

使用Apple访问令牌

通过传递有效的Apple身份令牌和Bundle标识符请求AccessToken。

do {
   try authService.requestAccessTokenForAppleToken(appleToken: "AppleIdentityToken", appBundleId: "Bundle_Id", scope: ["scope1", "scope2"], accessType: .OFFLINE, handler: { (error, errorResponse, accessToken) in
                 // process the response
             })
  } catch let err {
           // handle the error 
  }

获取访问令牌信息

可以通过以下方法获取访问令牌信息。

do {
    try authService.getTokenInfo("pass the accessToken") { (err, errResponse, token) in
            // token information is received here
        }
    } catch {
            // handle the error
    }

刷新访问令牌

如果访问令牌已过期,您可以提交刷新令牌并获取新的访问令牌。

 do {
     try authService.refreshAccessToken("your refreshToken", expiryType: OauthExpiryType.LONG) { (error, errorResponse, accessToken) -> Void in
            // Save the access token
    } catch let error {
            // print("error: \(error)")
    }

撤销访问令牌

撤销有效的AccessToken。

 do {
     try authService.revokeToken(token: "your token", tokenType: RevokeTokenHintType.ACCESS_TOKEN) { (success, err, errResp) in
               // success for revoking the access token
     } catch {
          // print error
     }

作者

karthik-dev Monica Raja

许可证

FullAuthIOSClient遵循MIT许可证。有关更多信息,请参阅LICENSE文件。