@absolutejs/auth 0.54.4 → 0.54.5
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/cli/migrate.js +2 -1
- package/dist/cli/migrate.js.map +3 -3
- package/dist/htmx/index.js +13 -1
- package/dist/htmx/index.js.map +3 -3
- package/dist/index.js +26 -2
- package/dist/index.js.map +4 -4
- package/dist/providers/clients.d.ts +1 -0
- package/dist/providers/index.js +13 -1
- package/dist/providers/index.js.map +3 -3
- package/package.json +2 -2
|
@@ -1591,6 +1591,7 @@ export declare const buildClientProviders: (providersConfiguration: OAuth2Config
|
|
|
1591
1591
|
url: string;
|
|
1592
1592
|
};
|
|
1593
1593
|
} & import("citra").ProviderConfig) | ({
|
|
1594
|
+
accessTokenPath: string[];
|
|
1594
1595
|
authorizationUrl: string;
|
|
1595
1596
|
isOIDC: false;
|
|
1596
1597
|
isRefreshable: true;
|
package/dist/providers/index.js
CHANGED
|
@@ -1811,6 +1811,7 @@ var providers = defineProviders({
|
|
|
1811
1811
|
}
|
|
1812
1812
|
},
|
|
1813
1813
|
withings: {
|
|
1814
|
+
accessTokenPath: ["body", "access_token"],
|
|
1814
1815
|
authorizationUrl: "https://account.withings.com/oauth2_user/authorize2",
|
|
1815
1816
|
isOIDC: false,
|
|
1816
1817
|
isRefreshable: true,
|
|
@@ -2665,10 +2666,21 @@ var buildOAuth2Client = async (meta, config) => {
|
|
|
2665
2666
|
if (!response.ok)
|
|
2666
2667
|
throw await createOAuth2FetchError(response);
|
|
2667
2668
|
const tokenResponse = await response.json();
|
|
2669
|
+
if (!tokenResponse || typeof tokenResponse !== "object") {
|
|
2670
|
+
throw new Error("OAuth token endpoint returned a non-object response");
|
|
2671
|
+
}
|
|
2672
|
+
const oauthError = Reflect.get(tokenResponse, "error");
|
|
2673
|
+
if (typeof oauthError === "string" && oauthError.length > 0) {
|
|
2674
|
+
throw new Error(`OAuth token exchange failed: ${oauthError}`);
|
|
2675
|
+
}
|
|
2668
2676
|
const nestedToken = meta.accessTokenPath ? readPath(tokenResponse, meta.accessTokenPath) : undefined;
|
|
2669
2677
|
if (typeof nestedToken === "string" && nestedToken.length > 0 && tokenResponse && typeof tokenResponse === "object") {
|
|
2670
2678
|
tokenResponse.access_token = nestedToken;
|
|
2671
2679
|
}
|
|
2680
|
+
const accessToken = Reflect.get(tokenResponse, "access_token");
|
|
2681
|
+
if (typeof accessToken !== "string" || accessToken.length === 0) {
|
|
2682
|
+
throw new Error("OAuth token endpoint returned no access_token");
|
|
2683
|
+
}
|
|
2672
2684
|
return tokenResponse;
|
|
2673
2685
|
}
|
|
2674
2686
|
};
|
|
@@ -2694,5 +2706,5 @@ export {
|
|
|
2694
2706
|
decodeJWT
|
|
2695
2707
|
};
|
|
2696
2708
|
|
|
2697
|
-
//# debugId=
|
|
2709
|
+
//# debugId=902C18A45F6C2D7A64756E2164756E21
|
|
2698
2710
|
//# sourceMappingURL=index.js.map
|