Skip to content

Instantly share code, notes, and snippets.

@dmennis
Last active March 19, 2019 18:39
Show Gist options
  • Save dmennis/30e43e3ba8ab7df79a5fe85973d7543e to your computer and use it in GitHub Desktop.
Save dmennis/30e43e3ba8ab7df79a5fe85973d7543e to your computer and use it in GitHub Desktop.
Drop-in auth UI
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