page_type | languages | products | |||||
---|---|---|---|---|---|---|---|
sample |
|
|
This code sample is meant to be used with Azure Functions, to generate a trusted token provision service. As part of the Azure Communication Services architecture, in order to access communication resources, users or applications require to have an Access Token
. It is recommended that the token provisioning logic is held in a trusted and secure service rather than directly on the client as a resource critical information is needed to generated tokens.The Azure Function will work as a trusted middleman between the user and the Communication Services
This quickstart sample includes the code that is explained as part of this document. See that document for additional details on how this sample works.
- An Azure account with an active subscription. For details, see Create an account for free.
- Visual Studio Code on one of the supported platforms.
- Node.js, Active LTS and Maintenance LTS versions (10.14.1 recommended). Use the
node --version
command to check your version. - The Azure Functions extension for Visual Studio Code.
- An active Communication Services resource and connection string. Create a Communication Services resource.
- Ensure to have the Azure Function Extension on Visual Studio. Click into the tab on the left side menu and initialize the project
- Open a terminal and navigate to the repository directory
- Run
cd Trusted Authentication Service
to get in the same directory as the function - Run
npm i
which will install the dependencies for the sample - In Visual Studio Code, click into the
index.js
file and pressF5
- Once it runs successfully, on your browser visit:
http://localhost:7071/api/Function
To deploy your Azure Function, you can follow step by step instructions
Generally, you will need to:
- Sign in to Azure from Visual Studio
- Publish your project to your Azure account. Here you will need to choose an existing subscription.
- Create a new Azure Function resource using the Visual Studio wizard or use an existing resource. For a new resource, you will need to configure it to your desired region, runtime and unique identifier.
- Wait for deployment to finalize
- Run the function 🎉