@sitecore-content-sdk/core 0.2.0-beta.10 → 0.2.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -17,7 +17,6 @@ const fetchBearerToken = async (options) => {
|
|
|
17
17
|
const audience = options.audience || constants_1.DEFAULT_SITECORE_AUTH_AUDIENCE;
|
|
18
18
|
const endpoint = options.endpoint || constants_1.DEFAULT_SITECORE_AUTH_ENDPOINT;
|
|
19
19
|
try {
|
|
20
|
-
// TODO:adjust when M2M endpoint is live
|
|
21
20
|
const authenticateResponse = await fetch(endpoint, {
|
|
22
21
|
method: 'POST',
|
|
23
22
|
headers: {
|
|
@@ -30,6 +29,9 @@ const fetchBearerToken = async (options) => {
|
|
|
30
29
|
grant_type: 'client_credentials',
|
|
31
30
|
}),
|
|
32
31
|
});
|
|
32
|
+
if (!authenticateResponse.ok) {
|
|
33
|
+
throw new Error(`Authentication failed with status: ${authenticateResponse.status}`);
|
|
34
|
+
}
|
|
33
35
|
const jsonResponse = await authenticateResponse.json();
|
|
34
36
|
return jsonResponse.access_token;
|
|
35
37
|
}
|
|
@@ -11,7 +11,6 @@ export const fetchBearerToken = async (options) => {
|
|
|
11
11
|
const audience = options.audience || DEFAULT_SITECORE_AUTH_AUDIENCE;
|
|
12
12
|
const endpoint = options.endpoint || DEFAULT_SITECORE_AUTH_ENDPOINT;
|
|
13
13
|
try {
|
|
14
|
-
// TODO:adjust when M2M endpoint is live
|
|
15
14
|
const authenticateResponse = await fetch(endpoint, {
|
|
16
15
|
method: 'POST',
|
|
17
16
|
headers: {
|
|
@@ -24,6 +23,9 @@ export const fetchBearerToken = async (options) => {
|
|
|
24
23
|
grant_type: 'client_credentials',
|
|
25
24
|
}),
|
|
26
25
|
});
|
|
26
|
+
if (!authenticateResponse.ok) {
|
|
27
|
+
throw new Error(`Authentication failed with status: ${authenticateResponse.status}`);
|
|
28
|
+
}
|
|
27
29
|
const jsonResponse = await authenticateResponse.json();
|
|
28
30
|
return jsonResponse.access_token;
|
|
29
31
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-content-sdk/core",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.12",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
},
|
|
78
78
|
"description": "",
|
|
79
79
|
"types": "types/index.d.ts",
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "0f881567f6a9a60932f17d6c0397f54f1ce7673c",
|
|
81
81
|
"files": [
|
|
82
82
|
"dist",
|
|
83
83
|
"types",
|