Skip to content

Commit 1d1f474

Browse files
committed
Updated some samples' auth to SAS token
1 parent 4098592 commit 1d1f474

3 files changed

Lines changed: 16 additions & 28 deletions

File tree

‎Samples/3D-layer/3D Elevation_experimental/3D Elevation.html‎

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,16 @@
4141

4242
// Add authentication details for connecting to Azure Maps
4343
authOptions: {
44-
// Use Microsoft Entra ID authentication in production
45-
authType: 'anonymous',
46-
clientId: 'e6b6ab59-eb5d-4d25-aa57-581135b927f0', // Your Azure Maps client id for accessing your Azure Maps account
44+
// Use SAS token for authentication
45+
authType: 'sas',
4746
getToken: function (resolve, reject, map) {
48-
// URL to your authentication service that retrieves an Microsoft Entra ID Token
49-
fetch('https://samples.azuremaps.com/api/GetAzureMapsToken')
50-
.then(function (response) {
51-
return response.text();
52-
})
53-
.then(function (token) {
54-
resolve(token);
55-
})
56-
.catch(function (error) {
57-
reject(new Error(`Failed to fetch Azure Maps token: ${error.message}`));
58-
});
47+
// URL to your authentication service that retrieves a SAS Token
48+
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsSasToken';
49+
50+
fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token));
5951
}
6052

61-
// Alternatively, use an Azure Maps key in development
62-
// Get an Azure Maps key at https://azuremaps.com/
63-
// NOTE: The primary key should be used as the key
53+
//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.
6454
//authType: 'subscriptionKey',
6555
//subscriptionKey: '[YOUR_AZURE_MAPS_KEY]'
6656
}

‎Samples/3D-layer/babylon.js/babylon.html‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,11 @@
9595

9696
// Add authentication details for connecting to Azure Maps.
9797
authOptions: {
98-
//Use Microsoft Entra ID authentication.
99-
authType: 'anonymous',
100-
clientId: 'e6b6ab59-eb5d-4d25-aa57-581135b927f0', // Your Azure Maps client id for accessing your Azure Maps account.
98+
// Use SAS token for authentication
99+
authType: 'sas',
101100
getToken: function (resolve, reject, map) {
102-
// URL to your authentication service that retrieves an Microsoft Entra ID Token.
103-
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsToken';
101+
// URL to your authentication service that retrieves a SAS Token
102+
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsSasToken';
104103

105104
fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token));
106105
}

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,15 @@
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.
31+
// Use SAS token for authentication
32+
authType: 'sas',
3433
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';
34+
// URL to your authentication service that retrieves a SAS Token
35+
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsSasToken';
3736

3837
fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token));
3938
}
40-
39+
4140
//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.
4241
//authType: 'subscriptionKey',
4342
//subscriptionKey: '[YOUR_AZURE_MAPS_KEY]'

0 commit comments

Comments
 (0)