@fluxbase/sdk 2026.1.1-rc.2 → 2026.1.1-rc.4
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/index.cjs +9 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -332,6 +332,7 @@ async function wrapAsyncVoid(operation) {
|
|
|
332
332
|
// src/auth.ts
|
|
333
333
|
var AUTH_STORAGE_KEY = "fluxbase.auth.session";
|
|
334
334
|
var OAUTH_PROVIDER_KEY = "fluxbase.auth.oauth_provider";
|
|
335
|
+
var OAUTH_REDIRECT_URI_KEY = "fluxbase.auth.oauth_redirect_uri";
|
|
335
336
|
var AUTO_REFRESH_TICK_THRESHOLD = 10;
|
|
336
337
|
var AUTO_REFRESH_TICK_MINIMUM = 1e3;
|
|
337
338
|
var MAX_REFRESH_RETRIES = 3;
|
|
@@ -924,14 +925,19 @@ var FluxbaseAuth = class {
|
|
|
924
925
|
if (!provider) {
|
|
925
926
|
throw new Error("No OAuth provider found. Call signInWithOAuth first.");
|
|
926
927
|
}
|
|
928
|
+
const redirectUri = this.storage?.getItem(OAUTH_REDIRECT_URI_KEY);
|
|
927
929
|
const params = new URLSearchParams({ code });
|
|
928
930
|
if (state) {
|
|
929
931
|
params.append("state", state);
|
|
930
932
|
}
|
|
933
|
+
if (redirectUri) {
|
|
934
|
+
params.append("redirect_uri", redirectUri);
|
|
935
|
+
}
|
|
931
936
|
const response = await this.fetch.get(
|
|
932
937
|
`/api/v1/auth/oauth/${provider}/callback?${params.toString()}`
|
|
933
938
|
);
|
|
934
939
|
this.storage?.removeItem(OAUTH_PROVIDER_KEY);
|
|
940
|
+
this.storage?.removeItem(OAUTH_REDIRECT_URI_KEY);
|
|
935
941
|
const session = {
|
|
936
942
|
...response,
|
|
937
943
|
expires_at: Date.now() + response.expires_in * 1e3
|
|
@@ -955,6 +961,9 @@ var FluxbaseAuth = class {
|
|
|
955
961
|
const url = result.data.url;
|
|
956
962
|
if (typeof window !== "undefined") {
|
|
957
963
|
this.storage?.setItem(OAUTH_PROVIDER_KEY, provider);
|
|
964
|
+
if (options?.redirect_uri) {
|
|
965
|
+
this.storage?.setItem(OAUTH_REDIRECT_URI_KEY, options.redirect_uri);
|
|
966
|
+
}
|
|
958
967
|
window.location.href = url;
|
|
959
968
|
} else {
|
|
960
969
|
throw new Error(
|