Skip to content

Latest commit

 

History

History
109 lines (73 loc) · 4.29 KB

File metadata and controls

109 lines (73 loc) · 4.29 KB

Deploy Locally

  1. Get Set up
    1. Prerequisites for Development Environment Setup
    2. Cloning the repo
    3. Installing dependencies
  2. Build Authentication Server Sample
  3. Run Authentication Server Sample
    1. Prerequisites to run the sample
    2. Update the appSettings.ts file
    3. Generate an Azure Active Directory Token Manually
    4. Run the App

Get Set up

Prerequisites for Development Environment Setup

Cloning the repo

Clone the repo: https://github.com/Azure-Samples/communication-services-authentication-hero-nodejs

# HTTPS
git clone https://github.com/Azure-Samples/communication-services-authentication-hero-nodejs.git

# SSH
git clone [email protected]:Azure-Samples/communication-services-authentication-hero-nodejs.git

Installing dependencies

Navigate to the project directory and install dependencies for all packages and samples:

# Navigate to the repository
cd communication-services-authentication-hero-nodejs/

# Install dependencies
npm install

Note: this may take some time the first time it runs

Build Authentication Server Sample

After installing all necessary dependencies, you can run the following command to build the repo.

# this command equals to npm run prettier && npm run lint:fix && npm run build-tsc
npm run build

This command consists of three sub-commands:

  1. npm run prettier - Formats code to ensure that all outputted code conforms to a consistent style defined in the .prettierrc.json file.
  2. npm run lint:fix - Instructs ESLint to try to fix issues which break what the .eslintrc.js file defines.
  3. npm run build-tsc - Compiles TypeScript files.

Note:

  1. This may take some time the first time it runs.
  2. More scripts are available for this repo, to see the full list, please check scripts section in the package.json file.

Run Authentication Server Sample

Prerequisites to run the sample

To be able to run this sample locally, you will first need to follow those prerequisites.

Update the appSettings.ts File

Before running the sample, you will need to replace the values in the appSettings.ts file:

  1. Replace connectionString and scopes for the Communication Services
  2. Replace clientId, tenantId and clientSecret for the Azure Active Directory.

Note: Values of clientId, tenantId and clientSecret are all from your auther-server-sample-webApi. If you created the app registrations in prerequisites using app creation scripts, then you should already have these values updated in your local repository.

Run the App

In order to run the Azure Communication Services Authentication Server sample,

  1. Go to the project root directory.

    # navigate to the repository
    cd communication-services-authentication-hero-nodejs/
  2. Run the following command.

    # Start the server
    npm run start
  3. We have two ways of testing the backend service

    • Calling the backend APIs directly with an Azure Active Directory Access Token
    • Using the MinimalClient

    Please see the two options in detail here. Test backend service.

    Here is a set of endpoints that can be tested. API Endpoints.

  4. During local development/testing, if the identity mapping needs to be verified in Graph for /api/user and /api/token endpoint, please use Graph Explorer. Sign in with your Azure Active Directory Identity and verify the response on GET https://graph.microsoft.com/v1.0/me/extensions endpoint.

Note: Want to contribute to this sample and help us make it even better? Check our contribution guide.