Giter VIP home page Giter VIP logo

mohsinalimat / kdsocialloginmanager Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kuldeepbhatt/kdsocialloginmanager

0.0 1.0 0.0 55 KB

POC : This repository holds the social login in iOS with multiple platforms and multiple schemes of login using OAuth 2.0 as well as login with Facebook, LinkedIn, Google directly. One can directly leverage framework as ready reckoner to support multiple social login on any one's application.

License: MIT License

Swift 98.41% Ruby 1.59%

kdsocialloginmanager's Introduction

KDSocialLoginManager

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

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

pod 'KDSocialLoginManager'

Requirements

Steps to successfully integrate the KDSocialLoginManager in your application

  • Add the URL Types for all the platforms you want to support in your application (e.g. Facebook, LinkedIn, Google) Screenshot 2021-07-27 at 23 01 12

  • Add the import statement in your controller from where you want to present the social login flow

import KDSocialLoginManager
  • Finally, add below code based on the platform (Facebook, Google, LinkedIn)

Facebook

LoginHandler.shared.facebookLogin(with: ["email", "public_profile"],
                                              presentingViewController: self) { result, error in
                if error != nil {
                    print("Error while Facebook login : \(String(describing: error?.localizedDescription))")
                    return
                }
                self.facebookLoginBtn.setTitle("Logout from Facebook", for: .normal)
                print("Facebook Login successfull: \(String(describing: result))")
            }
            

Google

LoginHandler.shared.googleLogin(with: "*********************************************.apps.googleusercontent.com",
                                            presentingViewController: self) { user, error in
                if error != nil {
                    print("Error while Google login : \(String(describing: error?.localizedDescription))")
                    return
                }
                self.googleLoginBtn.setTitle("Logout from Google", for: .normal)
                print("Google Login successfull: \(String(describing: user?.description))")
            }
            

LinkedIn : Since linked only supports OAuth 2.0

LoginHandler.shared.loginWithOAuth(for: .LinkedIn,
                                           clientID: "***************",
                                           redirectURI: URL(string: "linkedin://profile/******"),
                                           with: self) { token, error in
            (error == nil) ? (self.linkedInLoginBtn.setTitle("Logout", for: .normal)) : (print("Error while Linked In Login: \(String(describing: error?.localizedDescription))"))
        }

Google with OAuth 2.0

LoginHandler.shared.loginWithOAuth(for: .Google,
                                           clientID: "*********************************************.apps.googleusercontent.com",
                                           redirectURI: URL(string: "com.googleusercontent.apps.*********************************************"),
                                           with: self) { token, error in
            (error == nil) ? (self.googleLoginBtn.setTitle("Logout", for: .normal)) : (print("Error while Google Login: \(String(describing: error?.localizedDescription))"))
            

Author

kuldeepbhatt, [email protected]

License

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

kdsocialloginmanager's People

Contributors

kuldeepbhatt avatar kuldeep-dvt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.