integrate-sdk 0.8.13 → 0.8.14
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/adapters/auto-routes.js +8 -0
- package/dist/adapters/index.js +8 -0
- package/dist/adapters/nextjs.js +8 -0
- package/dist/adapters/node.js +8 -0
- package/dist/adapters/session-detector.js +8 -0
- package/dist/adapters/svelte-kit.js +8 -0
- package/dist/adapters/tanstack-start.js +8 -0
- package/dist/index.js +8 -0
- package/dist/oauth.js +8 -0
- package/dist/server.js +8 -0
- package/dist/src/oauth/manager.d.ts +12 -0
- package/dist/src/oauth/manager.d.ts.map +1 -1
- package/dist/src/oauth/window-manager.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -518,6 +518,7 @@ class OAuthWindowManager {
|
|
|
518
518
|
if (!isBrowser()) {
|
|
519
519
|
throw new Error("OAuthWindowManager.openRedirect() can only be used in browser environments");
|
|
520
520
|
}
|
|
521
|
+
console.log("[OAuthWindowManager] Redirecting to:", url.substring(0, 100) + (url.length > 100 ? "..." : ""));
|
|
521
522
|
window.location.href = url;
|
|
522
523
|
}
|
|
523
524
|
listenForCallback(mode, timeoutMs = 5 * 60 * 1000) {
|
|
@@ -685,10 +686,13 @@ class OAuthManager {
|
|
|
685
686
|
};
|
|
686
687
|
this.pendingAuths.set(state, pendingAuth);
|
|
687
688
|
this.savePendingAuthToStorage(state, pendingAuth);
|
|
689
|
+
console.log("[OAuth] Requesting authorization URL, flow mode:", this.flowConfig.mode);
|
|
688
690
|
const authUrl = await this.getAuthorizationUrl(provider, state, codeChallenge, config.redirectUri, codeVerifier);
|
|
691
|
+
console.log("[OAuth] Received authorization URL, length:", authUrl?.length);
|
|
689
692
|
if (!authUrl || authUrl.trim() === "") {
|
|
690
693
|
throw new Error("Received empty authorization URL from server");
|
|
691
694
|
}
|
|
695
|
+
console.log("[OAuth] Opening authorization URL, mode:", this.flowConfig.mode);
|
|
692
696
|
if (this.flowConfig.mode === "popup") {
|
|
693
697
|
this.windowManager.openPopup(authUrl, this.flowConfig.popupOptions);
|
|
694
698
|
try {
|
|
@@ -894,6 +898,7 @@ class OAuthManager {
|
|
|
894
898
|
return;
|
|
895
899
|
}
|
|
896
900
|
if (this.skipLocalStorage) {
|
|
901
|
+
console.log(`[OAuth] Token for ${provider} stored in memory only (skipLocalStorage: true). Configure setProviderToken/getProviderToken callbacks for persistence.`);
|
|
897
902
|
return;
|
|
898
903
|
}
|
|
899
904
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
@@ -914,6 +919,9 @@ class OAuthManager {
|
|
|
914
919
|
return;
|
|
915
920
|
}
|
|
916
921
|
}
|
|
922
|
+
if (this.skipLocalStorage) {
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
917
925
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
918
926
|
try {
|
|
919
927
|
const key = `integrate_token_${provider}`;
|
package/dist/adapters/index.js
CHANGED
|
@@ -518,6 +518,7 @@ class OAuthWindowManager {
|
|
|
518
518
|
if (!isBrowser()) {
|
|
519
519
|
throw new Error("OAuthWindowManager.openRedirect() can only be used in browser environments");
|
|
520
520
|
}
|
|
521
|
+
console.log("[OAuthWindowManager] Redirecting to:", url.substring(0, 100) + (url.length > 100 ? "..." : ""));
|
|
521
522
|
window.location.href = url;
|
|
522
523
|
}
|
|
523
524
|
listenForCallback(mode, timeoutMs = 5 * 60 * 1000) {
|
|
@@ -685,10 +686,13 @@ class OAuthManager {
|
|
|
685
686
|
};
|
|
686
687
|
this.pendingAuths.set(state, pendingAuth);
|
|
687
688
|
this.savePendingAuthToStorage(state, pendingAuth);
|
|
689
|
+
console.log("[OAuth] Requesting authorization URL, flow mode:", this.flowConfig.mode);
|
|
688
690
|
const authUrl = await this.getAuthorizationUrl(provider, state, codeChallenge, config.redirectUri, codeVerifier);
|
|
691
|
+
console.log("[OAuth] Received authorization URL, length:", authUrl?.length);
|
|
689
692
|
if (!authUrl || authUrl.trim() === "") {
|
|
690
693
|
throw new Error("Received empty authorization URL from server");
|
|
691
694
|
}
|
|
695
|
+
console.log("[OAuth] Opening authorization URL, mode:", this.flowConfig.mode);
|
|
692
696
|
if (this.flowConfig.mode === "popup") {
|
|
693
697
|
this.windowManager.openPopup(authUrl, this.flowConfig.popupOptions);
|
|
694
698
|
try {
|
|
@@ -894,6 +898,7 @@ class OAuthManager {
|
|
|
894
898
|
return;
|
|
895
899
|
}
|
|
896
900
|
if (this.skipLocalStorage) {
|
|
901
|
+
console.log(`[OAuth] Token for ${provider} stored in memory only (skipLocalStorage: true). Configure setProviderToken/getProviderToken callbacks for persistence.`);
|
|
897
902
|
return;
|
|
898
903
|
}
|
|
899
904
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
@@ -914,6 +919,9 @@ class OAuthManager {
|
|
|
914
919
|
return;
|
|
915
920
|
}
|
|
916
921
|
}
|
|
922
|
+
if (this.skipLocalStorage) {
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
917
925
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
918
926
|
try {
|
|
919
927
|
const key = `integrate_token_${provider}`;
|
package/dist/adapters/nextjs.js
CHANGED
|
@@ -518,6 +518,7 @@ class OAuthWindowManager {
|
|
|
518
518
|
if (!isBrowser()) {
|
|
519
519
|
throw new Error("OAuthWindowManager.openRedirect() can only be used in browser environments");
|
|
520
520
|
}
|
|
521
|
+
console.log("[OAuthWindowManager] Redirecting to:", url.substring(0, 100) + (url.length > 100 ? "..." : ""));
|
|
521
522
|
window.location.href = url;
|
|
522
523
|
}
|
|
523
524
|
listenForCallback(mode, timeoutMs = 5 * 60 * 1000) {
|
|
@@ -685,10 +686,13 @@ class OAuthManager {
|
|
|
685
686
|
};
|
|
686
687
|
this.pendingAuths.set(state, pendingAuth);
|
|
687
688
|
this.savePendingAuthToStorage(state, pendingAuth);
|
|
689
|
+
console.log("[OAuth] Requesting authorization URL, flow mode:", this.flowConfig.mode);
|
|
688
690
|
const authUrl = await this.getAuthorizationUrl(provider, state, codeChallenge, config.redirectUri, codeVerifier);
|
|
691
|
+
console.log("[OAuth] Received authorization URL, length:", authUrl?.length);
|
|
689
692
|
if (!authUrl || authUrl.trim() === "") {
|
|
690
693
|
throw new Error("Received empty authorization URL from server");
|
|
691
694
|
}
|
|
695
|
+
console.log("[OAuth] Opening authorization URL, mode:", this.flowConfig.mode);
|
|
692
696
|
if (this.flowConfig.mode === "popup") {
|
|
693
697
|
this.windowManager.openPopup(authUrl, this.flowConfig.popupOptions);
|
|
694
698
|
try {
|
|
@@ -894,6 +898,7 @@ class OAuthManager {
|
|
|
894
898
|
return;
|
|
895
899
|
}
|
|
896
900
|
if (this.skipLocalStorage) {
|
|
901
|
+
console.log(`[OAuth] Token for ${provider} stored in memory only (skipLocalStorage: true). Configure setProviderToken/getProviderToken callbacks for persistence.`);
|
|
897
902
|
return;
|
|
898
903
|
}
|
|
899
904
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
@@ -914,6 +919,9 @@ class OAuthManager {
|
|
|
914
919
|
return;
|
|
915
920
|
}
|
|
916
921
|
}
|
|
922
|
+
if (this.skipLocalStorage) {
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
917
925
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
918
926
|
try {
|
|
919
927
|
const key = `integrate_token_${provider}`;
|
package/dist/adapters/node.js
CHANGED
|
@@ -518,6 +518,7 @@ class OAuthWindowManager {
|
|
|
518
518
|
if (!isBrowser()) {
|
|
519
519
|
throw new Error("OAuthWindowManager.openRedirect() can only be used in browser environments");
|
|
520
520
|
}
|
|
521
|
+
console.log("[OAuthWindowManager] Redirecting to:", url.substring(0, 100) + (url.length > 100 ? "..." : ""));
|
|
521
522
|
window.location.href = url;
|
|
522
523
|
}
|
|
523
524
|
listenForCallback(mode, timeoutMs = 5 * 60 * 1000) {
|
|
@@ -685,10 +686,13 @@ class OAuthManager {
|
|
|
685
686
|
};
|
|
686
687
|
this.pendingAuths.set(state, pendingAuth);
|
|
687
688
|
this.savePendingAuthToStorage(state, pendingAuth);
|
|
689
|
+
console.log("[OAuth] Requesting authorization URL, flow mode:", this.flowConfig.mode);
|
|
688
690
|
const authUrl = await this.getAuthorizationUrl(provider, state, codeChallenge, config.redirectUri, codeVerifier);
|
|
691
|
+
console.log("[OAuth] Received authorization URL, length:", authUrl?.length);
|
|
689
692
|
if (!authUrl || authUrl.trim() === "") {
|
|
690
693
|
throw new Error("Received empty authorization URL from server");
|
|
691
694
|
}
|
|
695
|
+
console.log("[OAuth] Opening authorization URL, mode:", this.flowConfig.mode);
|
|
692
696
|
if (this.flowConfig.mode === "popup") {
|
|
693
697
|
this.windowManager.openPopup(authUrl, this.flowConfig.popupOptions);
|
|
694
698
|
try {
|
|
@@ -894,6 +898,7 @@ class OAuthManager {
|
|
|
894
898
|
return;
|
|
895
899
|
}
|
|
896
900
|
if (this.skipLocalStorage) {
|
|
901
|
+
console.log(`[OAuth] Token for ${provider} stored in memory only (skipLocalStorage: true). Configure setProviderToken/getProviderToken callbacks for persistence.`);
|
|
897
902
|
return;
|
|
898
903
|
}
|
|
899
904
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
@@ -914,6 +919,9 @@ class OAuthManager {
|
|
|
914
919
|
return;
|
|
915
920
|
}
|
|
916
921
|
}
|
|
922
|
+
if (this.skipLocalStorage) {
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
917
925
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
918
926
|
try {
|
|
919
927
|
const key = `integrate_token_${provider}`;
|
|
@@ -518,6 +518,7 @@ class OAuthWindowManager {
|
|
|
518
518
|
if (!isBrowser()) {
|
|
519
519
|
throw new Error("OAuthWindowManager.openRedirect() can only be used in browser environments");
|
|
520
520
|
}
|
|
521
|
+
console.log("[OAuthWindowManager] Redirecting to:", url.substring(0, 100) + (url.length > 100 ? "..." : ""));
|
|
521
522
|
window.location.href = url;
|
|
522
523
|
}
|
|
523
524
|
listenForCallback(mode, timeoutMs = 5 * 60 * 1000) {
|
|
@@ -685,10 +686,13 @@ class OAuthManager {
|
|
|
685
686
|
};
|
|
686
687
|
this.pendingAuths.set(state, pendingAuth);
|
|
687
688
|
this.savePendingAuthToStorage(state, pendingAuth);
|
|
689
|
+
console.log("[OAuth] Requesting authorization URL, flow mode:", this.flowConfig.mode);
|
|
688
690
|
const authUrl = await this.getAuthorizationUrl(provider, state, codeChallenge, config.redirectUri, codeVerifier);
|
|
691
|
+
console.log("[OAuth] Received authorization URL, length:", authUrl?.length);
|
|
689
692
|
if (!authUrl || authUrl.trim() === "") {
|
|
690
693
|
throw new Error("Received empty authorization URL from server");
|
|
691
694
|
}
|
|
695
|
+
console.log("[OAuth] Opening authorization URL, mode:", this.flowConfig.mode);
|
|
692
696
|
if (this.flowConfig.mode === "popup") {
|
|
693
697
|
this.windowManager.openPopup(authUrl, this.flowConfig.popupOptions);
|
|
694
698
|
try {
|
|
@@ -894,6 +898,7 @@ class OAuthManager {
|
|
|
894
898
|
return;
|
|
895
899
|
}
|
|
896
900
|
if (this.skipLocalStorage) {
|
|
901
|
+
console.log(`[OAuth] Token for ${provider} stored in memory only (skipLocalStorage: true). Configure setProviderToken/getProviderToken callbacks for persistence.`);
|
|
897
902
|
return;
|
|
898
903
|
}
|
|
899
904
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
@@ -914,6 +919,9 @@ class OAuthManager {
|
|
|
914
919
|
return;
|
|
915
920
|
}
|
|
916
921
|
}
|
|
922
|
+
if (this.skipLocalStorage) {
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
917
925
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
918
926
|
try {
|
|
919
927
|
const key = `integrate_token_${provider}`;
|
|
@@ -518,6 +518,7 @@ class OAuthWindowManager {
|
|
|
518
518
|
if (!isBrowser()) {
|
|
519
519
|
throw new Error("OAuthWindowManager.openRedirect() can only be used in browser environments");
|
|
520
520
|
}
|
|
521
|
+
console.log("[OAuthWindowManager] Redirecting to:", url.substring(0, 100) + (url.length > 100 ? "..." : ""));
|
|
521
522
|
window.location.href = url;
|
|
522
523
|
}
|
|
523
524
|
listenForCallback(mode, timeoutMs = 5 * 60 * 1000) {
|
|
@@ -685,10 +686,13 @@ class OAuthManager {
|
|
|
685
686
|
};
|
|
686
687
|
this.pendingAuths.set(state, pendingAuth);
|
|
687
688
|
this.savePendingAuthToStorage(state, pendingAuth);
|
|
689
|
+
console.log("[OAuth] Requesting authorization URL, flow mode:", this.flowConfig.mode);
|
|
688
690
|
const authUrl = await this.getAuthorizationUrl(provider, state, codeChallenge, config.redirectUri, codeVerifier);
|
|
691
|
+
console.log("[OAuth] Received authorization URL, length:", authUrl?.length);
|
|
689
692
|
if (!authUrl || authUrl.trim() === "") {
|
|
690
693
|
throw new Error("Received empty authorization URL from server");
|
|
691
694
|
}
|
|
695
|
+
console.log("[OAuth] Opening authorization URL, mode:", this.flowConfig.mode);
|
|
692
696
|
if (this.flowConfig.mode === "popup") {
|
|
693
697
|
this.windowManager.openPopup(authUrl, this.flowConfig.popupOptions);
|
|
694
698
|
try {
|
|
@@ -894,6 +898,7 @@ class OAuthManager {
|
|
|
894
898
|
return;
|
|
895
899
|
}
|
|
896
900
|
if (this.skipLocalStorage) {
|
|
901
|
+
console.log(`[OAuth] Token for ${provider} stored in memory only (skipLocalStorage: true). Configure setProviderToken/getProviderToken callbacks for persistence.`);
|
|
897
902
|
return;
|
|
898
903
|
}
|
|
899
904
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
@@ -914,6 +919,9 @@ class OAuthManager {
|
|
|
914
919
|
return;
|
|
915
920
|
}
|
|
916
921
|
}
|
|
922
|
+
if (this.skipLocalStorage) {
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
917
925
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
918
926
|
try {
|
|
919
927
|
const key = `integrate_token_${provider}`;
|
|
@@ -518,6 +518,7 @@ class OAuthWindowManager {
|
|
|
518
518
|
if (!isBrowser()) {
|
|
519
519
|
throw new Error("OAuthWindowManager.openRedirect() can only be used in browser environments");
|
|
520
520
|
}
|
|
521
|
+
console.log("[OAuthWindowManager] Redirecting to:", url.substring(0, 100) + (url.length > 100 ? "..." : ""));
|
|
521
522
|
window.location.href = url;
|
|
522
523
|
}
|
|
523
524
|
listenForCallback(mode, timeoutMs = 5 * 60 * 1000) {
|
|
@@ -685,10 +686,13 @@ class OAuthManager {
|
|
|
685
686
|
};
|
|
686
687
|
this.pendingAuths.set(state, pendingAuth);
|
|
687
688
|
this.savePendingAuthToStorage(state, pendingAuth);
|
|
689
|
+
console.log("[OAuth] Requesting authorization URL, flow mode:", this.flowConfig.mode);
|
|
688
690
|
const authUrl = await this.getAuthorizationUrl(provider, state, codeChallenge, config.redirectUri, codeVerifier);
|
|
691
|
+
console.log("[OAuth] Received authorization URL, length:", authUrl?.length);
|
|
689
692
|
if (!authUrl || authUrl.trim() === "") {
|
|
690
693
|
throw new Error("Received empty authorization URL from server");
|
|
691
694
|
}
|
|
695
|
+
console.log("[OAuth] Opening authorization URL, mode:", this.flowConfig.mode);
|
|
692
696
|
if (this.flowConfig.mode === "popup") {
|
|
693
697
|
this.windowManager.openPopup(authUrl, this.flowConfig.popupOptions);
|
|
694
698
|
try {
|
|
@@ -894,6 +898,7 @@ class OAuthManager {
|
|
|
894
898
|
return;
|
|
895
899
|
}
|
|
896
900
|
if (this.skipLocalStorage) {
|
|
901
|
+
console.log(`[OAuth] Token for ${provider} stored in memory only (skipLocalStorage: true). Configure setProviderToken/getProviderToken callbacks for persistence.`);
|
|
897
902
|
return;
|
|
898
903
|
}
|
|
899
904
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
@@ -914,6 +919,9 @@ class OAuthManager {
|
|
|
914
919
|
return;
|
|
915
920
|
}
|
|
916
921
|
}
|
|
922
|
+
if (this.skipLocalStorage) {
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
917
925
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
918
926
|
try {
|
|
919
927
|
const key = `integrate_token_${provider}`;
|
package/dist/index.js
CHANGED
|
@@ -534,6 +534,7 @@ class OAuthWindowManager {
|
|
|
534
534
|
if (!isBrowser()) {
|
|
535
535
|
throw new Error("OAuthWindowManager.openRedirect() can only be used in browser environments");
|
|
536
536
|
}
|
|
537
|
+
console.log("[OAuthWindowManager] Redirecting to:", url.substring(0, 100) + (url.length > 100 ? "..." : ""));
|
|
537
538
|
window.location.href = url;
|
|
538
539
|
}
|
|
539
540
|
listenForCallback(mode, timeoutMs = 5 * 60 * 1000) {
|
|
@@ -718,10 +719,13 @@ class OAuthManager {
|
|
|
718
719
|
};
|
|
719
720
|
this.pendingAuths.set(state, pendingAuth);
|
|
720
721
|
this.savePendingAuthToStorage(state, pendingAuth);
|
|
722
|
+
console.log("[OAuth] Requesting authorization URL, flow mode:", this.flowConfig.mode);
|
|
721
723
|
const authUrl = await this.getAuthorizationUrl(provider, state, codeChallenge, config.redirectUri, codeVerifier);
|
|
724
|
+
console.log("[OAuth] Received authorization URL, length:", authUrl?.length);
|
|
722
725
|
if (!authUrl || authUrl.trim() === "") {
|
|
723
726
|
throw new Error("Received empty authorization URL from server");
|
|
724
727
|
}
|
|
728
|
+
console.log("[OAuth] Opening authorization URL, mode:", this.flowConfig.mode);
|
|
725
729
|
if (this.flowConfig.mode === "popup") {
|
|
726
730
|
this.windowManager.openPopup(authUrl, this.flowConfig.popupOptions);
|
|
727
731
|
try {
|
|
@@ -927,6 +931,7 @@ class OAuthManager {
|
|
|
927
931
|
return;
|
|
928
932
|
}
|
|
929
933
|
if (this.skipLocalStorage) {
|
|
934
|
+
console.log(`[OAuth] Token for ${provider} stored in memory only (skipLocalStorage: true). Configure setProviderToken/getProviderToken callbacks for persistence.`);
|
|
930
935
|
return;
|
|
931
936
|
}
|
|
932
937
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
@@ -947,6 +952,9 @@ class OAuthManager {
|
|
|
947
952
|
return;
|
|
948
953
|
}
|
|
949
954
|
}
|
|
955
|
+
if (this.skipLocalStorage) {
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
950
958
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
951
959
|
try {
|
|
952
960
|
const key = `integrate_token_${provider}`;
|
package/dist/oauth.js
CHANGED
|
@@ -518,6 +518,7 @@ class OAuthWindowManager {
|
|
|
518
518
|
if (!isBrowser()) {
|
|
519
519
|
throw new Error("OAuthWindowManager.openRedirect() can only be used in browser environments");
|
|
520
520
|
}
|
|
521
|
+
console.log("[OAuthWindowManager] Redirecting to:", url.substring(0, 100) + (url.length > 100 ? "..." : ""));
|
|
521
522
|
window.location.href = url;
|
|
522
523
|
}
|
|
523
524
|
listenForCallback(mode, timeoutMs = 5 * 60 * 1000) {
|
|
@@ -685,10 +686,13 @@ class OAuthManager {
|
|
|
685
686
|
};
|
|
686
687
|
this.pendingAuths.set(state, pendingAuth);
|
|
687
688
|
this.savePendingAuthToStorage(state, pendingAuth);
|
|
689
|
+
console.log("[OAuth] Requesting authorization URL, flow mode:", this.flowConfig.mode);
|
|
688
690
|
const authUrl = await this.getAuthorizationUrl(provider, state, codeChallenge, config.redirectUri, codeVerifier);
|
|
691
|
+
console.log("[OAuth] Received authorization URL, length:", authUrl?.length);
|
|
689
692
|
if (!authUrl || authUrl.trim() === "") {
|
|
690
693
|
throw new Error("Received empty authorization URL from server");
|
|
691
694
|
}
|
|
695
|
+
console.log("[OAuth] Opening authorization URL, mode:", this.flowConfig.mode);
|
|
692
696
|
if (this.flowConfig.mode === "popup") {
|
|
693
697
|
this.windowManager.openPopup(authUrl, this.flowConfig.popupOptions);
|
|
694
698
|
try {
|
|
@@ -894,6 +898,7 @@ class OAuthManager {
|
|
|
894
898
|
return;
|
|
895
899
|
}
|
|
896
900
|
if (this.skipLocalStorage) {
|
|
901
|
+
console.log(`[OAuth] Token for ${provider} stored in memory only (skipLocalStorage: true). Configure setProviderToken/getProviderToken callbacks for persistence.`);
|
|
897
902
|
return;
|
|
898
903
|
}
|
|
899
904
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
@@ -914,6 +919,9 @@ class OAuthManager {
|
|
|
914
919
|
return;
|
|
915
920
|
}
|
|
916
921
|
}
|
|
922
|
+
if (this.skipLocalStorage) {
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
917
925
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
918
926
|
try {
|
|
919
927
|
const key = `integrate_token_${provider}`;
|
package/dist/server.js
CHANGED
|
@@ -518,6 +518,7 @@ class OAuthWindowManager {
|
|
|
518
518
|
if (!isBrowser()) {
|
|
519
519
|
throw new Error("OAuthWindowManager.openRedirect() can only be used in browser environments");
|
|
520
520
|
}
|
|
521
|
+
console.log("[OAuthWindowManager] Redirecting to:", url.substring(0, 100) + (url.length > 100 ? "..." : ""));
|
|
521
522
|
window.location.href = url;
|
|
522
523
|
}
|
|
523
524
|
listenForCallback(mode, timeoutMs = 5 * 60 * 1000) {
|
|
@@ -685,10 +686,13 @@ class OAuthManager {
|
|
|
685
686
|
};
|
|
686
687
|
this.pendingAuths.set(state, pendingAuth);
|
|
687
688
|
this.savePendingAuthToStorage(state, pendingAuth);
|
|
689
|
+
console.log("[OAuth] Requesting authorization URL, flow mode:", this.flowConfig.mode);
|
|
688
690
|
const authUrl = await this.getAuthorizationUrl(provider, state, codeChallenge, config.redirectUri, codeVerifier);
|
|
691
|
+
console.log("[OAuth] Received authorization URL, length:", authUrl?.length);
|
|
689
692
|
if (!authUrl || authUrl.trim() === "") {
|
|
690
693
|
throw new Error("Received empty authorization URL from server");
|
|
691
694
|
}
|
|
695
|
+
console.log("[OAuth] Opening authorization URL, mode:", this.flowConfig.mode);
|
|
692
696
|
if (this.flowConfig.mode === "popup") {
|
|
693
697
|
this.windowManager.openPopup(authUrl, this.flowConfig.popupOptions);
|
|
694
698
|
try {
|
|
@@ -894,6 +898,7 @@ class OAuthManager {
|
|
|
894
898
|
return;
|
|
895
899
|
}
|
|
896
900
|
if (this.skipLocalStorage) {
|
|
901
|
+
console.log(`[OAuth] Token for ${provider} stored in memory only (skipLocalStorage: true). Configure setProviderToken/getProviderToken callbacks for persistence.`);
|
|
897
902
|
return;
|
|
898
903
|
}
|
|
899
904
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
@@ -914,6 +919,9 @@ class OAuthManager {
|
|
|
914
919
|
return;
|
|
915
920
|
}
|
|
916
921
|
}
|
|
922
|
+
if (this.skipLocalStorage) {
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
917
925
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
918
926
|
try {
|
|
919
927
|
const key = `integrate_token_${provider}`;
|
|
@@ -187,6 +187,12 @@ export declare class OAuthManager {
|
|
|
187
187
|
clearAllPendingAuths(): void;
|
|
188
188
|
/**
|
|
189
189
|
* Save provider token to database (via callback) or localStorage
|
|
190
|
+
*
|
|
191
|
+
* Storage decision logic:
|
|
192
|
+
* 1. If setTokenCallback is configured → use callback exclusively (no localStorage)
|
|
193
|
+
* 2. If skipLocalStorage is true → skip localStorage (token only in memory)
|
|
194
|
+
* 3. Otherwise → use localStorage (when callbacks are NOT configured AND skipLocalStorage is false)
|
|
195
|
+
*
|
|
190
196
|
* @param provider - Provider name (e.g., 'github', 'gmail')
|
|
191
197
|
* @param tokenData - Token data to store, or null to delete
|
|
192
198
|
* @param context - Optional user context (userId, organizationId, etc.) for multi-tenant apps
|
|
@@ -194,6 +200,12 @@ export declare class OAuthManager {
|
|
|
194
200
|
private saveProviderToken;
|
|
195
201
|
/**
|
|
196
202
|
* Load provider token from database (via callback) or localStorage
|
|
203
|
+
*
|
|
204
|
+
* Loading decision logic (mirrors saveProviderToken):
|
|
205
|
+
* 1. If getTokenCallback is configured → use callback exclusively (no localStorage)
|
|
206
|
+
* 2. If skipLocalStorage is true → skip localStorage (return undefined)
|
|
207
|
+
* 3. Otherwise → use localStorage (when callbacks are NOT configured AND skipLocalStorage is false)
|
|
208
|
+
*
|
|
197
209
|
* Returns undefined if not found or invalid
|
|
198
210
|
*/
|
|
199
211
|
private loadProviderToken;
|
|
@@ -1 +1 @@
|
|
|
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