BlackBerry Spark Communications Services Guide

Configuring Web Examples to use Azure Active Directory

The SDK example applications for JavaScript can be changed to integrate with Azure Active Directory both as your identity provider and for user management.

This page guides you through the changes you can make to the example applications to integrate with Azure using the Support library.

Azure Configuration

Before running the example applications with Azure Active Directory, you must first configure Azure for the example you wish to run.

  1. First, configure Azure Active Directory as your Identity Provider.
  2. Next, configure Azure Active Directory for User Management.

Configure the Example Application

Open the example application's HTML file. Find the tags that include the Azure Active Directory 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_azure.js file. Set the CLIENT_ID to the Application ID that was assigned to your application when you configured Azure Active Directory as your Identity Provider.

// The client ID of the Microsoft Azure OAuth 2.0 service.
const CLIENT_ID = '11111111-1111-1111-1111-111111111111';

Set the TENANT_ID to the Directory ID that was assigned to your Azure Active Directory account when you configured Azure Active Directory as your Identity Provider.

// The tenant ID of your organization.
const TENANT_ID = '00000000-0000-0000-0000-000000000000';