Created
October 11, 2018 16:17
-
-
Save mobilequickie/8a4ced0c3bb91e735e5ae82e5421f8ee to your computer and use it in GitHub Desktop.
AWS Mobile SDK AuthUI code snippet for main ViewController. This is the same for User Pools, Facebook, and Google sign-in.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import AWSAuthCore | |
import AWSAuthUI | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
showSignIn() | |
} | |
func showSignIn() { | |
if !AWSSignInManager.sharedInstance().isLoggedIn { | |
AWSAuthUIViewController | |
.presentViewController(with: self.navigationController!, | |
configuration: nil, | |
completionHandler: { (provider: AWSSignInProvider, error: Error?) in | |
if error != nil { | |
print("Error occurred: \(String(describing: error))") | |
} else { | |
// Sign in successful. | |
print("Identity provider: \(provider.identityProviderName)") | |
} | |
}) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment