To run the example project, clone the repo, and run pod install
from the Example directory first.
KDSocialLoginManager is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'KDSocialLoginManager'
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)
-
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)
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))")
}
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))")
}
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))"))
}
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))"))
kuldeepbhatt, [email protected]
KDSocialLoginManager is available under the MIT license. See the LICENSE file for more info.