Skip to content

Google Sign in

Mk5 edited this page Mar 13, 2021 · 12 revisions

Google authorization has few additional steps to done.

Android

  1. Add google auth library to gradle dependencies
    compile 'com.google.android.gms:play-services-auth:16.0.0'
  2. Add your sha1 fingerprint to firebase console. ./gradlew signingReport will show you your current fingerprints. More info here.

RoboVM

  1. Add Firebase Google Auth frameworks
  2. Add custom URL schemes into your Info.plist.xml
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLName</key>
            <string>{YOUR_REVERSE_CLIENT_ID_FROM_GOOGLE_SERVICE_PLIST}</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>{YOUR_REVERSE_CLIENT_ID_FROM_GOOGLE_SERVICE_PLIST}</string>
            </array>
        </dict>
    </array>

The original tutorial for that is here: https://firebase.google.com/docs/auth/ios/google-signin (pt 2.1)

GWT

The web platform is quite different so you can use some special configuration if you need it.

// Use this if your app should always show up the google accounts list
GdxFIRAuthHtml.setGoogleAuthAlwaysPromptForAccount(true);

// Use this if you prefer popup authorization - it is default behaviour
GdxFIRAuthHtml.setGoogleAuthViaPopup(true);

// Use this if you prefer redirect authorization
GdxFIRAuthHtml.setGoogleAuthViaRedirect(true);

Examples

GdxFIRAuth.inst().google().signIn().then(new Consumer() {
    @Override
    public void accept(GdxFirebaseUser gdxFirebaseUser) {
        
    }
});
GdxFIRAuth.inst().google().signOut();
Clone this wiki locally