Configure Login

Version 4 supports WordPress login using JSON Web Token. You need to install the https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/ plugin to make the WordPress authentication work.

However you can skip that if you want and go for Google/Phone login (via Firebase). Google and Phone login requires the SHA-1 key to be added to your firebase console.

Setup various login options in the app.

Make sure your app is configured with Firebase properly. Also make sure you have added the debug SHA-1 key for debugging and release SHA-1 key for release.

Generate Debug SHA-1 Key

  1. Select Gradle in android studio from right panel

  2. Select Your App

  3. In tasks -> android-> signingReport

  4. Double click signingReport

  5. You will find the SHA-1 fingerprint in the "Gradle Console"

    Copy this SHA-1 key and paste it in firebase console (Project Structure page).

Enable SignIn Option in Firebase Console

  1. Click on Authentication

  2. Switch to Sign-in method tab.

  3. Enable the options that you want to add to the app.

Add code to the app

  1. Go to AuthFragment.java

  2. Find this code

AuthFragment.java
private void signIn(){
        startActivityForResult(
                AuthUI.getInstance()
                        .createSignInIntentBuilder()
                        .setAvailableProviders(Arrays.asList(
                                new AuthUI.IdpConfig.GoogleBuilder().build(), //Google Login
                                new AuthUI.IdpConfig.PhoneBuilder().build())  //Phone Login
                        )
                        .build(),
                RC_SIGN_IN);
    }

This will add Email, Phone and Google sign in option to the app. You can remove / add / rearrange them to adjust the option.

You can add your siginin provides as mentioned here

Note that if you will generate the signed APK for play store, the login will not work until you paste in the Google App Signing keys to the firebase console.

Facebook Login​

  1. On the Facebook for Developers site, get the App ID and an App Secret for your app.

  2. In the Firebase console, open the Auth section.

  3. On the Sign in method tab, enable the Facebook sign-in method and specify the App ID and App Secret you got from Facebook.

  4. Then, make sure your OAuth redirect URI (e.g. my-app-12345.firebaseapp.com/__/auth/handler) is listed as one of your OAuth redirect URIs in your Facebook app's settings page on the Facebook for Developers site in the Product Settings > Facebook Login config.

You also need to generate a separate Key Hash in order to use the Facebook login using the openssl. You'll find more information about this on Facebook login Quick-start page on Facebook for developers site.

Last updated