Resolving the PlatformException: ApiException 10 in Flutter with Google Sign-In

Resolving the PlatformException: ApiException 10 in Flutter with Google Sign-In

19 December 2024 Stephan Petzl Leave a comment Tech-Help

Encountering the PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10) error can be a common hurdle when integrating Google Sign-In in Flutter applications. This issue typically arises due to misconfigured authentication credentials. In this guide, we will explore the most effective solution to address this error.

Understanding the Issue

This error often occurs if the SHA-1 or SHA-256 fingerprints are not correctly configured in the Firebase console for your application. These fingerprints are crucial for authenticating your app with Google’s servers.

Step-by-Step Solution

Follow these steps to resolve the ApiException 10 error:

  1. Generate SHA Fingerprints: Use the following command to generate the required SHA-1 and SHA-256 fingerprints:
    keytool -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore

    Ensure you have the correct keystore path and alias.

  2. Add Fingerprints to Firebase: Navigate to the Firebase console and add these SHA fingerprints under your app’s settings.
  3. Download Updated Configuration: After adding the fingerprints, download the updated google-services.json file and replace the existing one in your project under android/app.
  4. Clean and Rebuild: In your terminal, run the following command to clean your project:
    flutter clean

    Then rebuild your app to apply the changes.

  5. Check Google Play Console: If using Google Play’s app signing feature, ensure you also register the SHA fingerprints found in the Play Console.

Additional Considerations

If the above steps do not resolve the issue, ensure that the Google Sign-In method is enabled in the Firebase Authentication section. Additionally, verify that your OAuth consent screen is correctly configured in the Google API Console.

Enhancing Your Testing Workflow with Repeato

As you work through resolving integration issues like the ApiException 10, maintaining a robust testing workflow becomes essential. Repeato, a no-code test automation tool, can be instrumental in streamlining the testing process for your Flutter applications. Leveraging computer vision and AI, Repeato allows you to quickly create, run, and maintain tests, ensuring that your app’s authentication and other features work seamlessly across both iOS and Android platforms.

Like this article? there’s more where that came from!