BlackBerry Spark Communications Services Guide

Google Sign-In as your Identity Provider

BlackBerry Spark Communications Services can authenticate a user with Google Sign-In. If your users already sign into your application using Google Sign-In, you can easily configure the SDK to use it as your application's identity provider.

Configure a Firebase Project

To enable authentication with Google Sign-In, you must create a new Firebase project.

On the Firebase console, select Add Project.

Firebase Google Authentication

To enable Google Sign-In authentication in your Firebase project, select the Develop section in the left sidebar and click Authentication.

Select Firebase Authentication

Open the Sign-In method tab.

Select Firebase Authentication Sign-in Method

Click on Google.

Enable Google as the Firebase Authentication Sign-in Method

In the Google sign-in method window, ensure that the Enable toggle is on and configure any remaining values required by Google Sign-In.

Firebase Google Authentication

Configure your Target Platform

The next step depends on whether you are developing for a mobile operating system or the web.

If you are building an Android or iOS application, you must add it to Firebase with the following steps.

Open the project settings by clicking the settings icon in the top left corner.

Firebase Project Settings

Select Android or iOS and provide the information necessary to add your application to Firebase.

Add Application to Firebase Project

If you are building an web application, you must configure how Google Sign-In will interface with it.

Go to the Google APIs Dashboard and select your application's project.

From the left sidebar, select Credentials.

Select Google Sign-In Credentials

Under the OAuth 2.0 client IDs heading, click on the client named Web client (auto created by Google Service).

Select Web Client

Configure your application's Authorized JavaScript origins and Authorized redirect URIs as directed by Google Sign-In. You will need to add redirect URI for each example application that you intend to run. For example, you might configure your application as shown below.

Example Configuration of Google Sign-In Web Client

Configure your Domain

On your BlackBerry Online Account page, select your application to manage its configuration and then open the Communications Services tab.

Set the Token Info Endpoint URL to:

https://www.googleapis.com/oauth2/v3/tokeninfo

Set the User Info Endpoint to:

https://www.googleapis.com/oauth2/v3/tokeninfo

Set the OAuth Client ID to the Web client ID value from Google sign-in method page, as noted above.

Domain Configuration for Google Sign-In

Additional Step for Android

If you are building an Android application, you must add an additional value to the to OAuth Client IDs list when configuring your domain.

Open the google-services.json file that you were given by the Firebase setup process. Locate the oauth_client array entry for client_type 1 and copy the corresponding client_id value into the OAuth Client IDs field on the BlackBerry Online Account page. If that array does not have such an entry, then you must go back to the Firebase console and add the SHA-1 hash of your application as directed when you configured Google as a sign-in method.

For example, if your google-services.json file contained the following, you would copy 000-aaa.apps.googleusercontent.com into the field.

"oauth_client": [
  {
    "client_id": "000-aaa.apps.googleusercontent.com",
    "client_type": 1,
    "android_info": {
      "package_name": "com.example.application",
      "certificate_hash": "0000000000000000000000000000000000000000"
    }
  },
  {
    "client_id": "000-bbb.apps.googleusercontent.com",
    "client_type": 3
  }    

Examples

The SDK example applications can be set up to use Google Sign-In as your identity provider.