How can I fix sign out bug on AWS Cognito with flutter?


I’m doing an app using flutter that uses AWS Cognito for authentication, but every time the user sign of the app this black screen appears, I’ve searched but could not find out what is wrong, can anyone help me?

Here is my authentication code:

signIn(username, password, context) async {
try {
  SignInResult res =
      await Amplify.Auth.signIn(username: username, password: password);
  if (res.isSignedIn) {
        .push(MaterialPageRoute(builder: (context) => HomePage()));
} on AuthException catch (e) {


signOut() async {
try {
  await Amplify.Auth.signOut();
} on AuthException catch (e) {


And this is how I’m calling the function:

leading: IconButton(
          onPressed: () {
          icon: Icon(Icons.arrow_back)),

the black screen that appears


When logging out your user with Cognito, you need to pass a redirect URI in your request, so Cognito knows what to do after the sign out has happened. This URI also has to be registered as a possible URL in your app client configuration, in order to determine whether or not this is intended or malicious behaviour.

As you’ve stated in the comments on your question, you have not configured any sign out URI. So Cognito redirects to a blank page since it has no information on how to proceed otherwise.

Screenshot of URL configuration Cognito

Answered By – stijndepestel

Answer Checked By – Marilyn (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *