- Install Node.js.
- (Recommended) Install Visual Studio Code (Stable Build).
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
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
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:
npm run prettier
- Formats code to ensure that all outputted code conforms to a consistent style defined in the.prettierrc.json
file.npm run lint:fix
- Instructs ESLint to try to fix issues which break what the.eslintrc.js
file defines.npm run build-tsc
- Compiles TypeScript files.
Note:
- This may take some time the first time it runs.
- More scripts are available for this repo, to see the full list, please check
scripts
section in thepackage.json
file.
To be able to run this sample locally, you will first need to follow those prerequisites.
Before running the sample, you will need to replace the values in the appSettings.ts
file:
- Replace
connectionString
andscopes
for the Communication Services - Replace
clientId
,tenantId
andclientSecret
for the Azure Active Directory.
Note: Values of
clientId
,tenantId
andclientSecret
are all from yourauther-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.
In order to run the Azure Communication Services Authentication Server sample,
-
Go to the project root directory.
# navigate to the repository cd communication-services-authentication-hero-nodejs/
-
Run the following command.
# Start the server npm run start
-
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.
-
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 GEThttps://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.