Cidaas 1.1.1

Cidaas 1.1.1

Maintained by [Cidaas].


GitHub

Stars0
Watchers0
Forks0
Issues0
Contributors1
Pull Requests0



 
Depends on:
Alamofire~> 4.7.3
OneTimePassword~> 3.1.4
CryptoSwift~> 0.12
SwiftKeychainWrapper~> 3.0
 

Cidaas 1.1.1

  • By
  • Cidaas

cidaas-sdk-ios-v2

Build Status codecov.io Swift support XCode support CocoaPods Compatible Platform

The steps here will guide you through setting up and managing authentication and authorization in your apps using cidaas SDK.

Table of Contents

Requirements

Operating System Xcode Swift
iOS 10.0 or above 9.0 or above 3.3 or above

Installation

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

pod 'Cidaas'

Getting started

The following steps are to be followed to use this cidaas SDK.

Create a plist file named as cidaas.plist and fill all the inputs in key value pair. The inputs are below mentioned.

A sample plist file would look like this :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>DomainURL</key>
        <string>Your Domain URL</string>
        <key>RedirectURL</key>
        <string>Your redirect url</string>
        <key>ClientID</key>
        <string>Your client id</string>
    </dict>
</plist>

Following sections will help you to generate some of the information that is needed for plist.

Getting Client Id and urls

You can get this by creating your App in App settings section of cidaas Admin portal. Once you select the right scope and application type, and fill in all mandatory fields, you can use the generated Client ID and re-direct URLs.

Initialisation

The first step of integrating cidaas sdk is the initialisation process.

var cidaas = Cidaas();

or use the shared instance

var cidaas = Cidaas.shared

Usage

Native Browser Login

Classic Login

You can login using your native browser and redirects to the App once successfully logged in. To login with your native browser call loginWithBrowser().

cidaas.loginWithBrowser(delegate: self) {
    switch $0 {
        case .success(let successResponse):
            // your success code here
            break
        case .failure(let error):
            // your failure code here
            break
    }
}

Social Login

You can also perform social login using your native browser and redirects to the App once successfully logged in. To perform social login call loginWithSocial().

cidaas.loginWithSocial(provider: "your_social_provider", delegate: self) { 
    switch $0 {
        case .success(let successResponse):
            // your success code here
            break
        case .failure(let error):
            // your failure code here
            break
    }
}

where social provider may be either facebook, google, linkedin or any other providers

Use customScheme or universalLinks to return back the control from browser to App.

Note : Don't forget to add the custom scheme url in your App's redirect url section

If you use custom scheme, configure your URL types and resume the SDK from AppDelegate's open url method

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
    Cidaas.shared.handleToken(url: url)
    return true
}

If you use universal links, configure your Domain setup and resume the SDK from AppDelegate's userActivity method

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
    let url = userActivity.webpageURL!
    Cidaas.shared.handleToken(url: url)
    return true
}

Screenshots

Screen 1 Screen 2