Last active
March 19, 2019 18:39
-
-
Save dmennis/30e43e3ba8ab7df79a5fe85973d7543e to your computer and use it in GitHub Desktop.
Drop-in auth UI
This file contains 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 AWSMobileClient | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
initializeAWSMobileClient() // Initialize the AWSMobileClient | |
} | |
// Use the iOS SDK drop-in Auth UI to show login options to user (Basic auth, Google, or Facebook) | |
// Note: The view controller implementing the drpo-in auth UI needs to be associated with a Navigation Controller. | |
func showSignIn() { | |
AWSMobileClient.sharedInstance().showSignIn(navigationController: self.navigationController!, { | |
(userState, error) in | |
if(error == nil){ // Successful signin | |
DispatchQueue.main.async { | |
print("User successfully logged in") | |
} | |
} | |
}) | |
} | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment