From 7b558d3bc2629f1caffad8ef55dd004a69397d2f Mon Sep 17 00:00:00 2001 From: Scott Kang Date: Thu, 25 May 2023 17:10:47 +0800 Subject: [PATCH 1/2] chore: add authentication options --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index 97998d1..c477b87 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,33 @@ const DefaultMap: React.FC = () => ( export default DefaultMap ``` +## Authentication + +The subscription key is intended for development environments only and must not be utilized in a production application. Azure Maps provides various authentication options for applications to use. See [here](https://learn.microsoft.com/en-us/azure/azure-maps/how-to-manage-authentication) for more details. + +```javascript +// AAD +authOptions: { + authType: AuthenticationType.aad, + clientId: '...', + aadAppId: '...', + aadTenant: '...' +} +``` + +```javascript +// Anonymous +authOptions: { + authType: AuthenticationType.anonymous, + clientId: '...', + getToken: (resolve, reject) => { + // URL to your authentication service that retrieves an Azure Active Directory Token. + var tokenServiceUrl = "https://example.com/api/GetAzureMapsToken"; + fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token)); + } +} +``` + ## Local development with [Playground Package](https://github.com/Azure/react-azure-maps-playground) If you want to do some local development using [Playground Package](https://github.com/Azure/react-azure-maps-playground) with local link to the package, you need to make the following steps: From ab785b5c8f76ceb826a2cf96ff737047d9a93ad2 Mon Sep 17 00:00:00 2001 From: Scott Kang Date: Thu, 25 May 2023 17:15:09 +0800 Subject: [PATCH 2/2] chore: add sas authentication options --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index c477b87..8aaa2b3 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,18 @@ authOptions: { } ``` +```javascript +// SAS Token +authOptions: { + authType: AuthenticationType.sas, + getToken: (resolve, reject) => { + // URL to your authentication service that retrieves a SAS Token. + var tokenServiceUrl = "https://example.com/api/GetSASToken"; + fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token)); + } +} +``` + ## Local development with [Playground Package](https://github.com/Azure/react-azure-maps-playground) If you want to do some local development using [Playground Package](https://github.com/Azure/react-azure-maps-playground) with local link to the package, you need to make the following steps: