BlackBerry Spark Communications Services Guide

Configuring Web Examples to use Google Sign-In and Google People

The SDK example applications for JavaScript can be changed to integrate with Google Sign-In as your identity provider and Google People for user management.

This page guides you through the changes you can make to the example applications to integrate with Google Sign-In and Google People using the Support library.

Google Configuration

Before running the example applications with Google Sign-In and Google People, you must first configure those services for the example you wish to run.

  1. First, configure Google Sign-In as your Identity Provider.
  2. Next, configure Google People for User Management.

Configure the Example Application

Open the example application's HTML file. Find the tags that include the Google Sign-In support and uncomment them while also commenting-out the default support for no user authentication. When complete, it should look similar to the following.

<!-- Select one of the following configurations (mutually exclusive): -->

<!-- 1. Simplified: Use below .js to configure your app to work without authentication (no identity provider) -->
<!--
<script src="../support/auth/MockAuthManager.js"></script>
<script src="../support/identity/MockUserManager.js"></script>
<script src="js/config_mock.js"></script>
-->

<!-- 2. Google: Use below .js files to configure application to work with Google -->
<script src="https://apis.google.com/js/api.js"></script>
<script src="../support/auth/GoogleAuthManager.js"></script>
<script src="../support/identity/GooglePeopleUserManager.js"></script>
<script src="js/config_google.js"></script>

<!-- 3. Microsoft: Use below .js files to configure application to work with Azure -->
<!--
<script src="../support/auth/AzureAuthManager.js"></script>
<script src="../support/identity/AzureUserManager.js"></script>
<script src="js/config_azure.js"></script>
-->

Open the example application's config_google.js file. Set the CLIENT_ID to the Web client ID that was assigned to your application when you configured Google Sign-In as your Identity Provider.

// The client ID of the Google OAuth 2.0 service.
const CLIENT_ID = '000.apps.googleusercontent.com';