@bytescale/sdk 3.0.0-alpha.17 → 3.0.0-alpha.18
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.
- package/dist/browser/cjs/main.js +5 -2
- package/package.json +1 -1
package/dist/browser/cjs/main.js
CHANGED
|
@@ -2753,14 +2753,17 @@ var AuthManager = /*#__PURE__*/function (_BaseAPI) {
|
|
|
2753
2753
|
value: function getAccessToken(authUrl, headers) {
|
|
2754
2754
|
try {
|
|
2755
2755
|
var _this13 = this;
|
|
2756
|
+
var _a;
|
|
2756
2757
|
var endpointName = "Your auth API endpoint";
|
|
2757
2758
|
var requiredContentType = _this13.contentTypeText;
|
|
2758
2759
|
return AuthManagerBrowser_await(_this13.doFetch(authUrl, {
|
|
2759
2760
|
method: "GET",
|
|
2760
2761
|
headers: headers
|
|
2761
2762
|
}, false), function (result) {
|
|
2762
|
-
|
|
2763
|
-
|
|
2763
|
+
var actualContentType = (_a = result.headers.get(_this13.contentType)) !== null && _a !== void 0 ? _a : "";
|
|
2764
|
+
// Support content types like "text/plain; charset=utf-8" and "text/plain"
|
|
2765
|
+
if (actualContentType.split(";")[0] !== requiredContentType) {
|
|
2766
|
+
throw new Error("".concat(endpointName, " returned \"").concat(actualContentType, "\" for the ").concat(_this13.contentType, " response header, but the Bytescale SDK requires \"").concat(requiredContentType, "\"."));
|
|
2764
2767
|
}
|
|
2765
2768
|
return AuthManagerBrowser_await(result.text(), function (jwt) {
|
|
2766
2769
|
if (jwt.length === 0) {
|