Swiftpack.co - Package - Adaptavant/fullauth-api-ios-client

FullAuthIOSClient

Build Status Version License Platform

Supported Operations

Requirements

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

Latest Version

1.0.1 is the current latest version For change logs refer Releases

Installation

FullAuthIOSClient is available through CocoaPods. To install it, simply add the following line to your Podfile:

CocoaPods

pod "FullAuthIOSClient"

Swift Package Manager

FullAuthIOSClient is available through Swift Package Manager. To install it, simply add the following dependency to your Package.swift

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

Requesting Access Token

There are few supported flows in the fullAuth specification to request access token as follows

Create an authService by providing the necessary inputs.

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

Using Resource Owner Credentials

A Resource Owner’s username and password are submitted as part of the request, and a token is issued upon successful authentication.

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 
    }

Using Google Access Token

Request AccessToken by passing valid google access token.

 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 
    }

Using Facebook Access Token

Request AccessToken by passing valid facebook access token.

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 
   }

Using Apple Access Token

Request AcccessToken by passing valid Apple identity token and Bundle Id

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 
  }

Using Microsoft Access Token

Request AcccessToken by passing valid Microsoft access token

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

Fetch access token information

Access token information can be obtained by the following method.

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

Refresh Access Token

You can submit a refresh token and receive a new access token if the access token had expired.

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

Revoke Access Token

Revoke a valid 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
     }

Author

karthik-dev Monica Raja

License

FullAuthIOSClient is available under the MIT license. See the LICENSE file for more info.

Github

link
Stars: 1

Dependencies

Used By

Total: 0

Releases

Microsoft Login Support - 2020-04-20 17:04:17

Adds the Microsoft Login support

Apple Access token support - 2020-03-02 11:07:55

  • Added the SignIn with Apple
  • Updated the AppMode initialize

Swift 4.2 - 2019-06-26 14:12:23

FullAuthiOSClient Live Release - 2018-12-10 11:40:54

  • Revoke Token and Token Info Api Changes
  • Build with fastlane

FullAuthiOSClient Live Release - 2018-11-22 11:31:00

Fixed Architecture Issue. expires will be in Int64

FullAuthiOSClient Live Release - 2018-11-17 06:19:03

Added the property "expires" in OAuthAccessToken which gives the expiry time of the AccessToken