Last updated:
0 purchases
game services firebase auth
🎮 Game Services FirebaseAuth Plugin #
A Flutter plugin that simplifies Firebase Authentication using GameCenter on iOS and Play Games on Android.
Features #
Cross-Platform Support: Authenticate users via GameCenter (iOS) and Play Games (Android) using Firebase.
Simple Integration: Minimal setup to sign in, link accounts, and manage authentication.
Requirements #
Firebase Auth
Installation #
To install the plugin, add the following to your pubspec.yaml:
dependencies:
game_services_firebase_auth: ^latest_version
copied to clipboard
Then, run the following command to fetch the dependency:
flutter pub get
copied to clipboard
Carefully follow the setup instructions for both iOS and Android to avoid configuration errors.
🍏 iOS Setup #
Ensure Firebase is properly configured for your iOS project. Follow the Firebase setup guide.
Open your project in Xcode, navigate to the Signing & Capabilities tab, and add the Game Center capability. Learn more.
Enable Game Center authentication in the Firebase Console.
🤖 Android Setup #
Refer to the official documentation for enabling Play Games services.
Make sure Firebase is configured correctly for Android. Setup instructions here.
Retrieve your project’s SHA-1 keys using the command below:
./gradlew signingReport
copied to clipboard
Add the SHA-1 keys to your Firebase Console, including debug and production keys.
Create a Web OAuth client ID in the Google Cloud Console and save the credentials (ID & secret).
Enable Google Play Games as a sign-in provider in the Firebase Console. Use the OAuth credentials created in the previous step.
For each SHA-1 key (e.g., one for debug and one for Play Console), create a corresponding OAuth Android client ID in Google Cloud Console.
Activate Play Games on your app in the Google Play Console and fill in the required fields.
Create Play Services credentials for each key (from step 6).
Add the following metadata to your AndroidManifest.xml:
<meta-data
android:name="com.google.android.gms.games.APP_ID"
android:value="@string/game_services_project_id" />
<meta-data
android:name="io.revoltgames.game_services_firebase_auth.OAUTH_2_WEB_CLIENT_ID"
android:value="@string/game_services_oauth_2_web_client_id" />
copied to clipboard
In your res/values/strings.xml, add the following values (replace XXXXXX with your actual values):
<resources>
<string name="game_services_project_id" translatable="false">XXXXXX</string>
<string name="game_services_oauth_2_web_client_id" translatable="false">XXXXXX</string>
</resources>
copied to clipboard
Finally, run the Firebase configuration command to ensure everything is set up:
flutterfire configure
copied to clipboard
Usage #
Sign In with Game Services #
await FirebaseAuth.instance.signInWithGamesServices();
copied to clipboard
Check if User is Linked with Game Services #
bool isLinked = firebaseUser.isLinkedWithGamesServices();
copied to clipboard
Link User with Game Services #
await firebaseUser.linkWithGamesServices();
copied to clipboard
Force Sign-In if Account Already Linked #
await firebaseUser.linkWithGamesServices(forceSignInWithGameServiceIfCredentialAlreadyUsed: true);
copied to clipboard
Troubleshooting #
iOS #
Error: Lexical or Preprocessor Issue (Xcode): Include of non-modular header inside framework module 'firebase_auth.FLTIdTokenChannelStreamHandle'
To resolve this issue:
Open your project in Xcode.
Navigate to Build Settings under your target.
Set Allow Non-modular Includes in Framework Modules to YES.
Contributing #
Contributions are welcome! Please check out the contributing guidelines for more details.
License #
This project is licensed under the BSD-3-Clause License. See the LICENSE file for more information.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.