Skip to content

Commit 514ea4e

Browse files
committed
Update style picker auth method
1 parent f2812af commit 514ea4e

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

‎Samples/Controls/Map Style Picker/Map Style Picker.html‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,17 @@
2828

2929
//Add authentication details for connecting to Azure Maps.
3030
authOptions: {
31-
//Use Microsoft Entra ID authentication.
32-
authType: 'anonymous',
33-
clientId: 'e6b6ab59-eb5d-4d25-aa57-581135b927f0', //Your Azure Maps client id for accessing your Azure Maps account.
34-
getToken: function (resolve, reject, map) {
35-
//URL to your authentication service that retrieves an Microsoft Entra ID Token.
36-
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsToken';
37-
38-
fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token));
31+
// Use SAS token for authentication
32+
authType: 'sas',
33+
getToken: (resolve, reject) => {
34+
// URL to your authentication service that retrieves a SAS Token
35+
fetch('https://samples.azuremaps.com/api/GetAzureMapsSasToken')
36+
.then(function (response) {
37+
resolve(response);
38+
})
39+
.catch(function (error) {
40+
reject(new Error(`Failed to fetch Azure Maps SAS token: ${error.message}`));
41+
});
3942
}
4043

4144
//Alternatively, use an Azure Maps key. Get an Azure Maps key at https://azure.com/maps. NOTE: The primary key should be used as the key.

0 commit comments

Comments
 (0)