- Originally created by Serhii Londar, I just put it into a swift package
- Install package: https://github.com/DevboiDesigns/LinkedIn.SignIn-SPM
- Setup app on LinkedIn
import LinkedIn_SignIn
- Credentials Helper
let linkedinCredentilas = [
"linkedInKey": "",
"linkedInSecret": "",
"redirectURL": ""
]
- Login proces - Opens a web view to sign and get access token, token can be used via the LinkedIn SignIn API
let linkedInConfig = LinkedInConfig(linkedInKey: linkedinCredentilas["linkedInKey"]!, linkedInSecret: linkedinCredentilas["linkedInSecret"]!, redirectURL: linkedinCredentilas["redirectURL"]!)
let linkedInHelper = LinkedinHelper(linkedInConfig: linkedInConfig)
linkedInHelper.login(from: getRootViewController(), completion: { (accessToken) in
// DO STUFF
}
GET ROOT VIEW CONTROLLER
static public func getRootViewController() -> UIViewController {
guard let screen = UIApplication.shared.connectedScenes.first as? UIWindowScene else { return .init() }
guard let root = screen.windows.first?.rootViewController else { return .init() }
return root
}
LinkedInSignIn is available under the MIT license. See the LICENSE file for more info.