Skip to content

Commit 2eca238

Browse files
authored
Merge pull request #179 from dubiety/users/charlie/sas-token
Add GetAzureMapsSasToken API
2 parents 1577434 + 5711ef8 commit 2eca238

286 files changed

Lines changed: 1413 additions & 1845 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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/Flowmap.gl/src/Flowmap.gl.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ function onload () {
3131

3232
//Add authentication details for connecting to Azure Maps.
3333
authOptions: {
34-
//Use Microsoft Entra ID authentication.
35-
authType: 'anonymous',
36-
clientId: 'e6b6ab59-eb5d-4d25-aa57-581135b927f0', //Your Azure Maps client id for accessing your Azure Maps account.
34+
// Use SAS token for authentication
35+
authType: 'sas',
3736
getToken: function (resolve, reject, map) {
38-
//URL to your authentication service that retrieves an Microsoft Entra ID Token.
39-
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsToken';
37+
// URL to your authentication service that retrieves a SAS Token
38+
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsSasToken';
4039

4140
fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token));
4241
}

Samples/3D-layer/Threebox/Threebox.html

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

3636
// Add authentication details for connecting to Azure Maps.
3737
authOptions: {
38-
// Use Microsoft Entra ID authentication.
39-
authType: 'anonymous',
40-
clientId: 'e6b6ab59-eb5d-4d25-aa57-581135b927f0', // Your Azure Maps client id for accessing your Azure Maps account.
38+
// Use SAS token for authentication
39+
authType: 'sas',
4140
getToken: function (resolve, reject, map) {
42-
// URL to your authentication service that retrieves an Microsoft Entra ID Token.
43-
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsToken';
41+
// URL to your authentication service that retrieves a SAS Token
42+
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsSasToken';
4443

4544
fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token));
4645
}

Samples/3D-layer/WebGL/WebGLLayer.html

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,21 +130,13 @@
130130

131131
// Add authentication details for connecting to Azure Maps
132132
authOptions: {
133-
// Use Microsoft Entra ID authentication in production
134-
authType: 'anonymous',
135-
clientId: 'e6b6ab59-eb5d-4d25-aa57-581135b927f0', // Your Azure Maps client id for accessing your Azure Maps account
133+
// Use SAS token for authentication
134+
authType: 'sas',
136135
getToken: function (resolve, reject, map) {
137-
// URL to your authentication service that retrieves an Microsoft Entra ID Token
138-
fetch('https://samples.azuremaps.com/api/GetAzureMapsToken')
139-
.then(function (response) {
140-
return response.text();
141-
})
142-
.then(function (token) {
143-
resolve(token);
144-
})
145-
.catch(function (error) {
146-
reject(new Error(`Failed to fetch Azure Maps token: ${error.message}`));
147-
});
136+
// URL to your authentication service that retrieves a SAS Token
137+
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsSasToken';
138+
139+
fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token));
148140
}
149141

150142
// Alternatively, use an Azure Maps key in development

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/3D-layer/deck.gl/deck.gl.html

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

3434
//Add your Azure Maps subscription client ID to the map SDK. Get an Azure Maps client ID at https://azure.com/maps
3535
authOptions: {
36-
//Use Microsoft Entra ID authentication.
37-
authType: 'anonymous',
38-
clientId: 'e6b6ab59-eb5d-4d25-aa57-581135b927f0', //Your Azure Maps client id for accessing your Azure Maps account.
36+
// Use SAS token for authentication
37+
authType: 'sas',
3938
getToken: function (resolve, reject, map) {
40-
//URL to your authentication service that retrieves an Microsoft Entra ID Token.
41-
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsToken';
39+
// URL to your authentication service that retrieves a SAS Token
40+
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsSasToken';
4241

4342
fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token));
4443
}

Samples/3D-layer/newyork/newyork.html

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

5555
//Add your Azure Maps subscription client ID to the map SDK. Get an Azure Maps client ID at https://azure.com/maps
5656
authOptions: {
57-
//Use Microsoft Entra ID authentication.
58-
authType: 'anonymous',
59-
clientId: 'e6b6ab59-eb5d-4d25-aa57-581135b927f0', //Your Azure Maps client id for accessing your Azure Maps account.
57+
// Use SAS token for authentication
58+
authType: 'sas',
6059
getToken: function (resolve, reject, map) {
61-
//URL to your authentication service that retrieves an Microsoft Entra ID Token.
62-
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsToken';
60+
// URL to your authentication service that retrieves a SAS Token
61+
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsSasToken';
6362

6463
fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token));
6564
}

Samples/3D-layer/three.js/three.js.html

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

155155
// Add authentication details for connecting to Azure Maps.
156156
authOptions: {
157-
// Use Microsoft Entra ID authentication.
158-
authType: 'anonymous',
159-
clientId: 'e6b6ab59-eb5d-4d25-aa57-581135b927f0', // Your Azure Maps client id for accessing your Azure Maps account.
157+
// Use SAS token for authentication
158+
authType: 'sas',
160159
getToken: function (resolve, reject, map) {
161-
// URL to your authentication service that retrieves an Microsoft Entra ID Token.
162-
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsToken';
160+
// URL to your authentication service that retrieves a SAS Token
161+
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsSasToken';
163162

164163
fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token));
165164
}

Samples/Animations/Animate a GPS trace/Animate a GPS trace.html

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

7979
//Add authentication details for connecting to Azure Maps.
8080
authOptions: {
81-
//Use Microsoft Entra ID authentication.
82-
authType: 'anonymous',
83-
clientId: 'e6b6ab59-eb5d-4d25-aa57-581135b927f0', //Your Azure Maps client id for accessing your Azure Maps account.
81+
// Use SAS token for authentication
82+
authType: 'sas',
8483
getToken: function (resolve, reject, map) {
85-
//URL to your authentication service that retrieves an Microsoft Entra ID Token.
86-
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsToken';
84+
// URL to your authentication service that retrieves a SAS Token
85+
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsSasToken';
8786

8887
fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token));
8988
}

Samples/Animations/Animate a Line/Animate a Line.html

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

3434
//Add authentication details for connecting to Azure Maps.
3535
authOptions: {
36-
//Use Microsoft Entra ID authentication.
37-
authType: 'anonymous',
38-
clientId: 'e6b6ab59-eb5d-4d25-aa57-581135b927f0', //Your Azure Maps client id for accessing your Azure Maps account.
36+
// Use SAS token for authentication
37+
authType: 'sas',
3938
getToken: function (resolve, reject, map) {
40-
//URL to your authentication service that retrieves an Microsoft Entra ID Token.
41-
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsToken';
39+
// URL to your authentication service that retrieves a SAS Token
40+
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsSasToken';
4241

4342
fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token));
4443
}

0 commit comments

Comments
 (0)