Drop-in auth

You are currently viewing the AWS SDK for Mobile documentation which is a collection of low-level libraries. Use the Amplify libraries for all new app development. Learn more

You can view the Mobile SDK API reference here.

The AWSMobileClient client supports a "drop-in" UI component that allows you to easily add the full capabilities for authentication to your application.

1AWSMobileClient.default().showSignIn(
2 navigationController: self.navigationController!, { (signInState, error) in
3 if let signInState = signInState {
4 print("Sign in flow completed: \(signInState)")
5 } else if let error = error {
6 print("error logging in: \(error.localizedDescription)")
7 }
8 }
9)

Note: The drop-in UI requires the use of a navigation controller. Please make sure your app has an active navigation controller which is passed in via the navigationController parameter.

Customization

You can change the following properties of the drop-in UI with the AWSMobileClient:

  • Logo: Any image file of png or jpg
  • Background Color: Any iOS UIColor
1AWSMobileClient.default()
2 .showSignIn(
3 navigationController: self.navigationController!,
4 signInUIOptions: SignInUIOptions(
5 // dismiss the sign-in process
6 canCancel: false,
7 logoImage: UIImage(
8 named: "MyCustomLogo"
9 ),
10 backgroundColor: UIColor.black
11 )
12 ) { (result, err) in
13 //handle results and errors
14 }