@supabase/auth-js 2.110.9 → 2.111.0
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/main/GoTrueClient.d.ts +35 -2
- package/dist/main/GoTrueClient.d.ts.map +1 -1
- package/dist/main/GoTrueClient.js +129 -47
- package/dist/main/GoTrueClient.js.map +1 -1
- package/dist/main/lib/constants.d.ts +13 -0
- package/dist/main/lib/constants.d.ts.map +1 -1
- package/dist/main/lib/constants.js +14 -1
- package/dist/main/lib/constants.js.map +1 -1
- package/dist/main/lib/helpers.d.ts +50 -1
- package/dist/main/lib/helpers.d.ts.map +1 -1
- package/dist/main/lib/helpers.js +160 -4
- package/dist/main/lib/helpers.js.map +1 -1
- package/dist/main/lib/types.d.ts +38 -0
- package/dist/main/lib/types.d.ts.map +1 -1
- package/dist/main/lib/types.js.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/module/GoTrueClient.d.ts +35 -2
- package/dist/module/GoTrueClient.d.ts.map +1 -1
- package/dist/module/GoTrueClient.js +131 -49
- package/dist/module/GoTrueClient.js.map +1 -1
- package/dist/module/lib/constants.d.ts +13 -0
- package/dist/module/lib/constants.d.ts.map +1 -1
- package/dist/module/lib/constants.js +13 -0
- package/dist/module/lib/constants.js.map +1 -1
- package/dist/module/lib/helpers.d.ts +50 -1
- package/dist/module/lib/helpers.d.ts.map +1 -1
- package/dist/module/lib/helpers.js +152 -4
- package/dist/module/lib/helpers.js.map +1 -1
- package/dist/module/lib/types.d.ts +38 -0
- package/dist/module/lib/types.d.ts.map +1 -1
- package/dist/module/lib/types.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/tsconfig.module.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/GoTrueClient.ts +169 -67
- package/src/lib/constants.ts +15 -0
- package/src/lib/helpers.ts +197 -5
- package/src/lib/types.ts +38 -0
- package/src/lib/version.ts +1 -1
|
@@ -609,7 +609,8 @@ export default class GoTrueClient {
|
|
|
609
609
|
* {
|
|
610
610
|
* data: {
|
|
611
611
|
* provider: 'github',
|
|
612
|
-
* url: <PROVIDER_URL_TO_REDIRECT_TO
|
|
612
|
+
* url: <PROVIDER_URL_TO_REDIRECT_TO>,
|
|
613
|
+
* flowId: <PKCE_FLOW_ID_OR_NULL>
|
|
613
614
|
* },
|
|
614
615
|
* error: null
|
|
615
616
|
* }
|
|
@@ -674,12 +675,29 @@ export default class GoTrueClient {
|
|
|
674
675
|
*
|
|
675
676
|
* @remarks
|
|
676
677
|
* - Used when `flowType` is set to `pkce` in client options.
|
|
678
|
+
* - When several PKCE flows are in flight at once, pass `options.flowId` so
|
|
679
|
+
* the code is exchanged with the verifier created by that specific flow.
|
|
680
|
+
* The flow id is returned by `signInWithOAuth`, and with
|
|
681
|
+
* `experimental.appendPkceFlowIdToRedirects` enabled it also arrives on
|
|
682
|
+
* your callback URL as the reserved `sb_flow_id` query parameter (read
|
|
683
|
+
* automatically in a browser).
|
|
684
|
+
* - When a flow id is present but its stored verifier is gone (evicted,
|
|
685
|
+
* already used, or from another device), the call fails with a verifier
|
|
686
|
+
* missing error instead of trying another flow's verifier — a mismatched
|
|
687
|
+
* verifier would consume the single-use code. Without any flow id the
|
|
688
|
+
* most recently stored verifier is used, as before.
|
|
677
689
|
*
|
|
678
690
|
* @example Exchange Auth Code
|
|
679
691
|
* ```js
|
|
680
692
|
* supabase.auth.exchangeCodeForSession('34e770dd-9ff9-416c-87fa-43b31d7ef225')
|
|
681
693
|
* ```
|
|
682
694
|
*
|
|
695
|
+
* @example Exchange Auth Code for a specific flow (e.g. in a server-side callback handler)
|
|
696
|
+
* ```js
|
|
697
|
+
* const flowId = requestUrl.searchParams.get('sb_flow_id')
|
|
698
|
+
* supabase.auth.exchangeCodeForSession(code, flowId ? { flowId } : undefined)
|
|
699
|
+
* ```
|
|
700
|
+
*
|
|
683
701
|
* @exampleResponse Exchange Auth Code
|
|
684
702
|
* ```json
|
|
685
703
|
* {
|
|
@@ -837,7 +855,9 @@ export default class GoTrueClient {
|
|
|
837
855
|
* }
|
|
838
856
|
* ```
|
|
839
857
|
*/
|
|
840
|
-
exchangeCodeForSession(authCode: string
|
|
858
|
+
exchangeCodeForSession(authCode: string, options?: {
|
|
859
|
+
flowId?: string;
|
|
860
|
+
}): Promise<AuthTokenResponse>;
|
|
841
861
|
/**
|
|
842
862
|
* Signs in a user by verifying a message signed by the user's private key.
|
|
843
863
|
* Supports Ethereum (via Sign-In-With-Ethereum) & Solana (Sign-In-With-Solana) standards,
|
|
@@ -2382,6 +2402,19 @@ export default class GoTrueClient {
|
|
|
2382
2402
|
* @param options.queryParams An object of key-value pairs containing query parameters granted to the OAuth application.
|
|
2383
2403
|
*/
|
|
2384
2404
|
private _getUrlForProvider;
|
|
2405
|
+
/**
|
|
2406
|
+
* Appends the reserved flow id parameter to a redirect URL so the callback
|
|
2407
|
+
* can be matched to the verifier stored for its flow. Opt-in via
|
|
2408
|
+
* `experimental.appendPkceFlowIdToRedirects`: redirect URLs are validated
|
|
2409
|
+
* against the project's allow list including the query string, so an extra
|
|
2410
|
+
* parameter can stop exact (non-wildcard) entries from matching.
|
|
2411
|
+
*/
|
|
2412
|
+
private _maybeAppendFlowIdToRedirect;
|
|
2413
|
+
/**
|
|
2414
|
+
* Generates and stores a PKCE challenge/verifier pair for a new flow,
|
|
2415
|
+
* logging any pending verifier the bounded slot ring evicts.
|
|
2416
|
+
*/
|
|
2417
|
+
private _getCodeChallengeAndMethod;
|
|
2385
2418
|
private _unenroll;
|
|
2386
2419
|
/**
|
|
2387
2420
|
* {@link GoTrueMFAApi#enroll}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoTrueClient.d.ts","sourceRoot":"","sources":["../../src/GoTrueClient.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAA;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from './GoTrueAdminApi';
|
|
2
|
-
import { AUTO_REFRESH_TICK_DURATION_MS, AUTO_REFRESH_TICK_THRESHOLD, DEFAULT_HEADERS, EXPIRY_MARGIN_MS, GOTRUE_URL, JWKS_TTL, REFRESH_FAILURE_COOLDOWN_MS, STORAGE_KEY, } from './lib/constants';
|
|
2
|
+
import { AUTO_REFRESH_TICK_DURATION_MS, AUTO_REFRESH_TICK_THRESHOLD, DEFAULT_HEADERS, EXPIRY_MARGIN_MS, GOTRUE_URL, JWKS_TTL, PKCE_FLOW_ID_PARAM, REFRESH_FAILURE_COOLDOWN_MS, STORAGE_KEY, } from './lib/constants';
|
|
3
3
|
import { AuthImplicitGrantRedirectError, AuthInvalidCredentialsError, AuthInvalidJwtError, AuthInvalidTokenResponseError, AuthPKCECodeVerifierMissingError, AuthPKCEGrantCodeExchangeError, AuthRefreshDiscardedError, AuthSessionMissingError, AuthUnknownError, isAuthApiError, isAuthError, isAuthImplicitGrantRedirectError, isAuthRefreshDiscardedError, isAuthRetryableFetchError, isAuthSessionMissingError, } from './lib/errors';
|
|
4
4
|
import { _request, _sessionResponse, _sessionResponsePassword, _ssoResponse, _userResponse, } from './lib/fetch';
|
|
5
|
-
import { assertPasskeyExperimentalEnabled, decodeJWT, deepClone, Deferred, generateCallbackId, getAlgorithm, getCodeChallengeAndMethod, getItemAsync, insecureUserWarningProxy, isBrowser, parseParametersFromURL, removeItemAsync, resolveFetch, retryable, setItemAsync, sleep, supportsLocalStorage, userNotAvailableProxy, validateExp, } from './lib/helpers';
|
|
5
|
+
import { appendFlowIdToRedirectTo, assertPasskeyExperimentalEnabled, decodeJWT, deepClone, Deferred, generateCallbackId, getAlgorithm, getCodeChallengeAndMethod, getItemAsync, insecureUserWarningProxy, isBrowser, parseParametersFromURL, pkceVerifierSlotKey, removeAllPKCEVerifiers, removeItemAsync, removePKCEVerifier, resolveFetch, retrievePKCEVerifier, retryable, setItemAsync, sleep, supportsLocalStorage, userNotAvailableProxy, validateExp, validatePKCEFlowId, } from './lib/helpers';
|
|
6
6
|
import { memoryLocalStorageAdapter } from './lib/local-storage';
|
|
7
7
|
import { LockAcquireTimeoutError } from './lib/locks';
|
|
8
8
|
import { polyfillGlobalThis } from './lib/polyfills';
|
|
@@ -714,6 +714,7 @@ class GoTrueClient {
|
|
|
714
714
|
*/
|
|
715
715
|
async signUp(credentials) {
|
|
716
716
|
var _a, _b, _c;
|
|
717
|
+
let flowId = null;
|
|
717
718
|
try {
|
|
718
719
|
let res;
|
|
719
720
|
if ('email' in credentials) {
|
|
@@ -722,11 +723,11 @@ class GoTrueClient {
|
|
|
722
723
|
let codeChallengeMethod = null;
|
|
723
724
|
if (this.flowType === 'pkce') {
|
|
724
725
|
;
|
|
725
|
-
[codeChallenge, codeChallengeMethod] = await
|
|
726
|
+
[codeChallenge, codeChallengeMethod, flowId] = await this._getCodeChallengeAndMethod();
|
|
726
727
|
}
|
|
727
728
|
res = await _request(this.fetch, 'POST', `${this.url}/signup`, {
|
|
728
729
|
headers: this.headers,
|
|
729
|
-
redirectTo: options === null || options === void 0 ? void 0 : options.emailRedirectTo,
|
|
730
|
+
redirectTo: this._maybeAppendFlowIdToRedirect(options === null || options === void 0 ? void 0 : options.emailRedirectTo, flowId),
|
|
730
731
|
body: {
|
|
731
732
|
email,
|
|
732
733
|
password,
|
|
@@ -757,7 +758,7 @@ class GoTrueClient {
|
|
|
757
758
|
}
|
|
758
759
|
const { data, error } = res;
|
|
759
760
|
if (error || !data) {
|
|
760
|
-
await
|
|
761
|
+
await removePKCEVerifier(this.storage, this.storageKey, flowId);
|
|
761
762
|
return this._returnResult({ data: { user: null, session: null }, error: error });
|
|
762
763
|
}
|
|
763
764
|
const session = data.session;
|
|
@@ -769,7 +770,7 @@ class GoTrueClient {
|
|
|
769
770
|
return this._returnResult({ data: { user, session }, error: null });
|
|
770
771
|
}
|
|
771
772
|
catch (error) {
|
|
772
|
-
await
|
|
773
|
+
await removePKCEVerifier(this.storage, this.storageKey, flowId);
|
|
773
774
|
if (isAuthError(error)) {
|
|
774
775
|
return this._returnResult({ data: { user: null, session: null }, error });
|
|
775
776
|
}
|
|
@@ -984,7 +985,8 @@ class GoTrueClient {
|
|
|
984
985
|
* {
|
|
985
986
|
* data: {
|
|
986
987
|
* provider: 'github',
|
|
987
|
-
* url: <PROVIDER_URL_TO_REDIRECT_TO
|
|
988
|
+
* url: <PROVIDER_URL_TO_REDIRECT_TO>,
|
|
989
|
+
* flowId: <PKCE_FLOW_ID_OR_NULL>
|
|
988
990
|
* },
|
|
989
991
|
* error: null
|
|
990
992
|
* }
|
|
@@ -1057,12 +1059,29 @@ class GoTrueClient {
|
|
|
1057
1059
|
*
|
|
1058
1060
|
* @remarks
|
|
1059
1061
|
* - Used when `flowType` is set to `pkce` in client options.
|
|
1062
|
+
* - When several PKCE flows are in flight at once, pass `options.flowId` so
|
|
1063
|
+
* the code is exchanged with the verifier created by that specific flow.
|
|
1064
|
+
* The flow id is returned by `signInWithOAuth`, and with
|
|
1065
|
+
* `experimental.appendPkceFlowIdToRedirects` enabled it also arrives on
|
|
1066
|
+
* your callback URL as the reserved `sb_flow_id` query parameter (read
|
|
1067
|
+
* automatically in a browser).
|
|
1068
|
+
* - When a flow id is present but its stored verifier is gone (evicted,
|
|
1069
|
+
* already used, or from another device), the call fails with a verifier
|
|
1070
|
+
* missing error instead of trying another flow's verifier — a mismatched
|
|
1071
|
+
* verifier would consume the single-use code. Without any flow id the
|
|
1072
|
+
* most recently stored verifier is used, as before.
|
|
1060
1073
|
*
|
|
1061
1074
|
* @example Exchange Auth Code
|
|
1062
1075
|
* ```js
|
|
1063
1076
|
* supabase.auth.exchangeCodeForSession('34e770dd-9ff9-416c-87fa-43b31d7ef225')
|
|
1064
1077
|
* ```
|
|
1065
1078
|
*
|
|
1079
|
+
* @example Exchange Auth Code for a specific flow (e.g. in a server-side callback handler)
|
|
1080
|
+
* ```js
|
|
1081
|
+
* const flowId = requestUrl.searchParams.get('sb_flow_id')
|
|
1082
|
+
* supabase.auth.exchangeCodeForSession(code, flowId ? { flowId } : undefined)
|
|
1083
|
+
* ```
|
|
1084
|
+
*
|
|
1066
1085
|
* @exampleResponse Exchange Auth Code
|
|
1067
1086
|
* ```json
|
|
1068
1087
|
* {
|
|
@@ -1220,15 +1239,15 @@ class GoTrueClient {
|
|
|
1220
1239
|
* }
|
|
1221
1240
|
* ```
|
|
1222
1241
|
*/
|
|
1223
|
-
async exchangeCodeForSession(authCode) {
|
|
1242
|
+
async exchangeCodeForSession(authCode, options) {
|
|
1224
1243
|
await this.initializePromise;
|
|
1225
1244
|
if (this.lock != null) {
|
|
1226
1245
|
// TODO(v3): remove legacy lock path
|
|
1227
1246
|
return this._acquireLock(this.lockAcquireTimeout, async () => {
|
|
1228
|
-
return this._exchangeCodeForSession(authCode);
|
|
1247
|
+
return this._exchangeCodeForSession(authCode, options);
|
|
1229
1248
|
});
|
|
1230
1249
|
}
|
|
1231
|
-
return this._exchangeCodeForSession(authCode);
|
|
1250
|
+
return this._exchangeCodeForSession(authCode, options);
|
|
1232
1251
|
}
|
|
1233
1252
|
/**
|
|
1234
1253
|
* Signs in a user by verifying a message signed by the user's private key.
|
|
@@ -1570,8 +1589,23 @@ class GoTrueClient {
|
|
|
1570
1589
|
throw error;
|
|
1571
1590
|
}
|
|
1572
1591
|
}
|
|
1573
|
-
async _exchangeCodeForSession(authCode) {
|
|
1574
|
-
const
|
|
1592
|
+
async _exchangeCodeForSession(authCode, options) {
|
|
1593
|
+
const hasExplicitFlowId = (options === null || options === void 0 ? void 0 : options.flowId) != null;
|
|
1594
|
+
const requestedFlowId = hasExplicitFlowId
|
|
1595
|
+
? validatePKCEFlowId(options === null || options === void 0 ? void 0 : options.flowId)
|
|
1596
|
+
: isBrowser()
|
|
1597
|
+
? validatePKCEFlowId(parseParametersFromURL(window.location.href)[PKCE_FLOW_ID_PARAM])
|
|
1598
|
+
: null;
|
|
1599
|
+
if (hasExplicitFlowId && !requestedFlowId) {
|
|
1600
|
+
this._debug('#_exchangeCodeForSession()', 'provided flowId is not a valid flow id', options === null || options === void 0 ? void 0 : options.flowId);
|
|
1601
|
+
}
|
|
1602
|
+
// With a flow id (explicit or from the callback URL) the lookup is
|
|
1603
|
+
// slot-only and a miss fails fast — see retrievePKCEVerifier. An invalid
|
|
1604
|
+
// explicit flow id also fails fast rather than borrowing another flow's
|
|
1605
|
+
// verifier.
|
|
1606
|
+
const { verifier: storageItem, flowId } = hasExplicitFlowId && !requestedFlowId
|
|
1607
|
+
? { verifier: null, flowId: null }
|
|
1608
|
+
: await retrievePKCEVerifier(this.storage, this.storageKey, requestedFlowId);
|
|
1575
1609
|
const [codeVerifier, redirectType] = (storageItem !== null && storageItem !== void 0 ? storageItem : '').split('/');
|
|
1576
1610
|
try {
|
|
1577
1611
|
if (!codeVerifier && this.flowType === 'pkce') {
|
|
@@ -1585,7 +1619,7 @@ class GoTrueClient {
|
|
|
1585
1619
|
},
|
|
1586
1620
|
xform: _sessionResponse,
|
|
1587
1621
|
});
|
|
1588
|
-
await
|
|
1622
|
+
await removePKCEVerifier(this.storage, this.storageKey, flowId);
|
|
1589
1623
|
if (error) {
|
|
1590
1624
|
throw error;
|
|
1591
1625
|
}
|
|
@@ -1603,7 +1637,7 @@ class GoTrueClient {
|
|
|
1603
1637
|
return this._returnResult({ data: Object.assign(Object.assign({}, data), { redirectType: redirectType !== null && redirectType !== void 0 ? redirectType : null }), error });
|
|
1604
1638
|
}
|
|
1605
1639
|
catch (error) {
|
|
1606
|
-
await
|
|
1640
|
+
await removePKCEVerifier(this.storage, this.storageKey, flowId);
|
|
1607
1641
|
if (isAuthError(error)) {
|
|
1608
1642
|
return this._returnResult({
|
|
1609
1643
|
data: { user: null, session: null, redirectType: null },
|
|
@@ -1802,6 +1836,7 @@ class GoTrueClient {
|
|
|
1802
1836
|
*/
|
|
1803
1837
|
async signInWithOtp(credentials) {
|
|
1804
1838
|
var _a, _b, _c, _d, _f;
|
|
1839
|
+
let flowId = null;
|
|
1805
1840
|
try {
|
|
1806
1841
|
if ('email' in credentials) {
|
|
1807
1842
|
const { email, options } = credentials;
|
|
@@ -1809,7 +1844,7 @@ class GoTrueClient {
|
|
|
1809
1844
|
let codeChallengeMethod = null;
|
|
1810
1845
|
if (this.flowType === 'pkce') {
|
|
1811
1846
|
;
|
|
1812
|
-
[codeChallenge, codeChallengeMethod] = await
|
|
1847
|
+
[codeChallenge, codeChallengeMethod, flowId] = await this._getCodeChallengeAndMethod();
|
|
1813
1848
|
}
|
|
1814
1849
|
const { error } = await _request(this.fetch, 'POST', `${this.url}/otp`, {
|
|
1815
1850
|
headers: this.headers,
|
|
@@ -1821,7 +1856,7 @@ class GoTrueClient {
|
|
|
1821
1856
|
code_challenge: codeChallenge,
|
|
1822
1857
|
code_challenge_method: codeChallengeMethod,
|
|
1823
1858
|
},
|
|
1824
|
-
redirectTo: options === null || options === void 0 ? void 0 : options.emailRedirectTo,
|
|
1859
|
+
redirectTo: this._maybeAppendFlowIdToRedirect(options === null || options === void 0 ? void 0 : options.emailRedirectTo, flowId),
|
|
1825
1860
|
});
|
|
1826
1861
|
return this._returnResult({ data: { user: null, session: null }, error });
|
|
1827
1862
|
}
|
|
@@ -1845,7 +1880,7 @@ class GoTrueClient {
|
|
|
1845
1880
|
throw new AuthInvalidCredentialsError('You must provide either an email or phone number.');
|
|
1846
1881
|
}
|
|
1847
1882
|
catch (error) {
|
|
1848
|
-
await
|
|
1883
|
+
await removePKCEVerifier(this.storage, this.storageKey, flowId);
|
|
1849
1884
|
if (isAuthError(error)) {
|
|
1850
1885
|
return this._returnResult({ data: { user: null, session: null }, error });
|
|
1851
1886
|
}
|
|
@@ -2080,29 +2115,30 @@ class GoTrueClient {
|
|
|
2080
2115
|
* ```
|
|
2081
2116
|
*/
|
|
2082
2117
|
async signInWithSSO(params) {
|
|
2083
|
-
var _a, _b, _c, _d
|
|
2118
|
+
var _a, _b, _c, _d;
|
|
2119
|
+
let flowId = null;
|
|
2084
2120
|
try {
|
|
2085
2121
|
let codeChallenge = null;
|
|
2086
2122
|
let codeChallengeMethod = null;
|
|
2087
2123
|
if (this.flowType === 'pkce') {
|
|
2088
2124
|
;
|
|
2089
|
-
[codeChallenge, codeChallengeMethod] = await
|
|
2125
|
+
[codeChallenge, codeChallengeMethod, flowId] = await this._getCodeChallengeAndMethod();
|
|
2090
2126
|
}
|
|
2091
2127
|
const result = await _request(this.fetch, 'POST', `${this.url}/sso`, {
|
|
2092
|
-
body: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ('providerId' in params ? { provider_id: params.providerId } : null)), ('domain' in params ? { domain: params.domain } : null)), { redirect_to: (
|
|
2128
|
+
body: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ('providerId' in params ? { provider_id: params.providerId } : null)), ('domain' in params ? { domain: params.domain } : null)), { redirect_to: this._maybeAppendFlowIdToRedirect((_a = params.options) === null || _a === void 0 ? void 0 : _a.redirectTo, flowId) }), (((_b = params === null || params === void 0 ? void 0 : params.options) === null || _b === void 0 ? void 0 : _b.captchaToken)
|
|
2093
2129
|
? { gotrue_meta_security: { captcha_token: params.options.captchaToken } }
|
|
2094
2130
|
: null)), { skip_http_redirect: true, code_challenge: codeChallenge, code_challenge_method: codeChallengeMethod }),
|
|
2095
2131
|
headers: this.headers,
|
|
2096
2132
|
xform: _ssoResponse,
|
|
2097
2133
|
});
|
|
2098
2134
|
// Automatically redirect in browser unless skipBrowserRedirect is true
|
|
2099
|
-
if (((
|
|
2135
|
+
if (((_c = result.data) === null || _c === void 0 ? void 0 : _c.url) && isBrowser() && !((_d = params.options) === null || _d === void 0 ? void 0 : _d.skipBrowserRedirect)) {
|
|
2100
2136
|
window.location.assign(result.data.url);
|
|
2101
2137
|
}
|
|
2102
2138
|
return this._returnResult(result);
|
|
2103
2139
|
}
|
|
2104
2140
|
catch (error) {
|
|
2105
|
-
await
|
|
2141
|
+
await removePKCEVerifier(this.storage, this.storageKey, flowId);
|
|
2106
2142
|
if (isAuthError(error)) {
|
|
2107
2143
|
return this._returnResult({ data: null, error });
|
|
2108
2144
|
}
|
|
@@ -2222,6 +2258,7 @@ class GoTrueClient {
|
|
|
2222
2258
|
* ```
|
|
2223
2259
|
*/
|
|
2224
2260
|
async resend(credentials) {
|
|
2261
|
+
let flowId = null;
|
|
2225
2262
|
try {
|
|
2226
2263
|
const endpoint = `${this.url}/resend`;
|
|
2227
2264
|
if ('email' in credentials) {
|
|
@@ -2230,7 +2267,7 @@ class GoTrueClient {
|
|
|
2230
2267
|
let codeChallengeMethod = null;
|
|
2231
2268
|
if (this.flowType === 'pkce') {
|
|
2232
2269
|
;
|
|
2233
|
-
[codeChallenge, codeChallengeMethod] = await
|
|
2270
|
+
[codeChallenge, codeChallengeMethod, flowId] = await this._getCodeChallengeAndMethod();
|
|
2234
2271
|
}
|
|
2235
2272
|
const { error } = await _request(this.fetch, 'POST', endpoint, {
|
|
2236
2273
|
headers: this.headers,
|
|
@@ -2241,10 +2278,10 @@ class GoTrueClient {
|
|
|
2241
2278
|
code_challenge: codeChallenge,
|
|
2242
2279
|
code_challenge_method: codeChallengeMethod,
|
|
2243
2280
|
},
|
|
2244
|
-
redirectTo: options === null || options === void 0 ? void 0 : options.emailRedirectTo,
|
|
2281
|
+
redirectTo: this._maybeAppendFlowIdToRedirect(options === null || options === void 0 ? void 0 : options.emailRedirectTo, flowId),
|
|
2245
2282
|
});
|
|
2246
2283
|
if (error) {
|
|
2247
|
-
await
|
|
2284
|
+
await removePKCEVerifier(this.storage, this.storageKey, flowId);
|
|
2248
2285
|
}
|
|
2249
2286
|
return this._returnResult({ data: { user: null, session: null }, error });
|
|
2250
2287
|
}
|
|
@@ -2266,7 +2303,7 @@ class GoTrueClient {
|
|
|
2266
2303
|
throw new AuthInvalidCredentialsError('You must provide either an email or phone number and a type');
|
|
2267
2304
|
}
|
|
2268
2305
|
catch (error) {
|
|
2269
|
-
await
|
|
2306
|
+
await removePKCEVerifier(this.storage, this.storageKey, flowId);
|
|
2270
2307
|
if (isAuthError(error)) {
|
|
2271
2308
|
return this._returnResult({ data: { user: null, session: null }, error });
|
|
2272
2309
|
}
|
|
@@ -2668,7 +2705,6 @@ class GoTrueClient {
|
|
|
2668
2705
|
// JWT contains a `session_id` which does not correspond to an active
|
|
2669
2706
|
// session in the database, indicating the user is signed out.
|
|
2670
2707
|
await this._removeSession();
|
|
2671
|
-
await removeItemAsync(this.storage, `${this.storageKey}-code-verifier`);
|
|
2672
2708
|
}
|
|
2673
2709
|
return this._returnResult({ data: { user: null }, error });
|
|
2674
2710
|
}
|
|
@@ -2800,6 +2836,7 @@ class GoTrueClient {
|
|
|
2800
2836
|
return await this._updateUser(attributes, options);
|
|
2801
2837
|
}
|
|
2802
2838
|
async _updateUser(attributes, options = {}) {
|
|
2839
|
+
let flowId = null;
|
|
2803
2840
|
try {
|
|
2804
2841
|
return await this._useSession(async (result) => {
|
|
2805
2842
|
const { data: sessionData, error: sessionError } = result;
|
|
@@ -2814,11 +2851,11 @@ class GoTrueClient {
|
|
|
2814
2851
|
let codeChallengeMethod = null;
|
|
2815
2852
|
if (this.flowType === 'pkce' && attributes.email != null) {
|
|
2816
2853
|
;
|
|
2817
|
-
[codeChallenge, codeChallengeMethod] = await
|
|
2854
|
+
[codeChallenge, codeChallengeMethod, flowId] = await this._getCodeChallengeAndMethod();
|
|
2818
2855
|
}
|
|
2819
2856
|
const { data, error: userError } = await _request(this.fetch, 'PUT', `${this.url}/user`, {
|
|
2820
2857
|
headers: this.headers,
|
|
2821
|
-
redirectTo: options === null || options === void 0 ? void 0 : options.emailRedirectTo,
|
|
2858
|
+
redirectTo: this._maybeAppendFlowIdToRedirect(options === null || options === void 0 ? void 0 : options.emailRedirectTo, flowId),
|
|
2822
2859
|
body: Object.assign(Object.assign({}, attributes), { code_challenge: codeChallenge, code_challenge_method: codeChallengeMethod }),
|
|
2823
2860
|
jwt: session.access_token,
|
|
2824
2861
|
xform: _userResponse,
|
|
@@ -2833,7 +2870,7 @@ class GoTrueClient {
|
|
|
2833
2870
|
});
|
|
2834
2871
|
}
|
|
2835
2872
|
catch (error) {
|
|
2836
|
-
await
|
|
2873
|
+
await removePKCEVerifier(this.storage, this.storageKey, flowId);
|
|
2837
2874
|
if (isAuthError(error)) {
|
|
2838
2875
|
return this._returnResult({ data: { user: null }, error });
|
|
2839
2876
|
}
|
|
@@ -3226,11 +3263,14 @@ class GoTrueClient {
|
|
|
3226
3263
|
this._debug('#_initialize()', 'begin', 'is PKCE flow', true);
|
|
3227
3264
|
if (!params.code)
|
|
3228
3265
|
throw new AuthPKCEGrantCodeExchangeError('No code detected.');
|
|
3229
|
-
const { data, error } = await this._exchangeCodeForSession(params.code
|
|
3266
|
+
const { data, error } = await this._exchangeCodeForSession(params.code, {
|
|
3267
|
+
flowId: params[PKCE_FLOW_ID_PARAM],
|
|
3268
|
+
});
|
|
3230
3269
|
if (error)
|
|
3231
3270
|
throw error;
|
|
3232
3271
|
const url = new URL(window.location.href);
|
|
3233
3272
|
url.searchParams.delete('code');
|
|
3273
|
+
url.searchParams.delete(PKCE_FLOW_ID_PARAM);
|
|
3234
3274
|
window.history.replaceState(window.history.state, '', url.toString());
|
|
3235
3275
|
return {
|
|
3236
3276
|
data: { session: data.session, redirectType: (_a = data.redirectType) !== null && _a !== void 0 ? _a : null },
|
|
@@ -3300,8 +3340,16 @@ class GoTrueClient {
|
|
|
3300
3340
|
* Checks if the current URL and backing storage contain parameters given by a PKCE flow
|
|
3301
3341
|
*/
|
|
3302
3342
|
async _isPKCECallback(params) {
|
|
3343
|
+
if (!params.code) {
|
|
3344
|
+
return false;
|
|
3345
|
+
}
|
|
3346
|
+
const flowId = validatePKCEFlowId(params[PKCE_FLOW_ID_PARAM]);
|
|
3347
|
+
if (flowId &&
|
|
3348
|
+
(await getItemAsync(this.storage, pkceVerifierSlotKey(this.storageKey, flowId)))) {
|
|
3349
|
+
return true;
|
|
3350
|
+
}
|
|
3303
3351
|
const currentStorageContent = await getItemAsync(this.storage, `${this.storageKey}-code-verifier`);
|
|
3304
|
-
return !!
|
|
3352
|
+
return !!currentStorageContent;
|
|
3305
3353
|
}
|
|
3306
3354
|
/**
|
|
3307
3355
|
* Inside a browser context, `signOut()` will remove the logged in user from the browser session and log them out - removing all items from localstorage and then trigger a `"SIGNED_OUT"` event.
|
|
@@ -3359,7 +3407,6 @@ class GoTrueClient {
|
|
|
3359
3407
|
var _a;
|
|
3360
3408
|
const removeCurrentSession = async () => {
|
|
3361
3409
|
await this._removeSession();
|
|
3362
|
-
await removeItemAsync(this.storage, `${this.storageKey}-code-verifier`);
|
|
3363
3410
|
};
|
|
3364
3411
|
const { data, error: sessionError } = result;
|
|
3365
3412
|
if (sessionError && !isAuthSessionMissingError(sessionError)) {
|
|
@@ -3691,9 +3738,10 @@ class GoTrueClient {
|
|
|
3691
3738
|
async resetPasswordForEmail(email, options = {}) {
|
|
3692
3739
|
let codeChallenge = null;
|
|
3693
3740
|
let codeChallengeMethod = null;
|
|
3741
|
+
let flowId = null;
|
|
3694
3742
|
if (this.flowType === 'pkce') {
|
|
3695
3743
|
;
|
|
3696
|
-
[codeChallenge, codeChallengeMethod] = await
|
|
3744
|
+
[codeChallenge, codeChallengeMethod, flowId] = await this._getCodeChallengeAndMethod(true // isPasswordRecovery
|
|
3697
3745
|
);
|
|
3698
3746
|
}
|
|
3699
3747
|
try {
|
|
@@ -3705,11 +3753,11 @@ class GoTrueClient {
|
|
|
3705
3753
|
gotrue_meta_security: { captcha_token: options.captchaToken },
|
|
3706
3754
|
},
|
|
3707
3755
|
headers: this.headers,
|
|
3708
|
-
redirectTo: options.redirectTo,
|
|
3756
|
+
redirectTo: this._maybeAppendFlowIdToRedirect(options.redirectTo, flowId),
|
|
3709
3757
|
});
|
|
3710
3758
|
}
|
|
3711
3759
|
catch (error) {
|
|
3712
|
-
await
|
|
3760
|
+
await removePKCEVerifier(this.storage, this.storageKey, flowId);
|
|
3713
3761
|
if (isAuthError(error)) {
|
|
3714
3762
|
return this._returnResult({ data: null, error });
|
|
3715
3763
|
}
|
|
@@ -3792,7 +3840,8 @@ class GoTrueClient {
|
|
|
3792
3840
|
* {
|
|
3793
3841
|
* data: {
|
|
3794
3842
|
* provider: 'github',
|
|
3795
|
-
* url: <PROVIDER_URL_TO_REDIRECT_TO
|
|
3843
|
+
* url: <PROVIDER_URL_TO_REDIRECT_TO>,
|
|
3844
|
+
* flowId: <PKCE_FLOW_ID_OR_NULL>
|
|
3796
3845
|
* },
|
|
3797
3846
|
* error: null
|
|
3798
3847
|
* }
|
|
@@ -3806,18 +3855,20 @@ class GoTrueClient {
|
|
|
3806
3855
|
}
|
|
3807
3856
|
async linkIdentityOAuth(credentials) {
|
|
3808
3857
|
var _a;
|
|
3858
|
+
let flowId = null;
|
|
3809
3859
|
try {
|
|
3810
3860
|
const { data, error } = await this._useSession(async (result) => {
|
|
3811
3861
|
var _a, _b, _c, _d, _f;
|
|
3812
3862
|
const { data, error } = result;
|
|
3813
3863
|
if (error)
|
|
3814
3864
|
throw error;
|
|
3815
|
-
const url = await this._getUrlForProvider(`${this.url}/user/identities/authorize`, credentials.provider, {
|
|
3865
|
+
const { url, flowId: urlFlowId } = await this._getUrlForProvider(`${this.url}/user/identities/authorize`, credentials.provider, {
|
|
3816
3866
|
redirectTo: (_a = credentials.options) === null || _a === void 0 ? void 0 : _a.redirectTo,
|
|
3817
3867
|
scopes: (_b = credentials.options) === null || _b === void 0 ? void 0 : _b.scopes,
|
|
3818
3868
|
queryParams: (_c = credentials.options) === null || _c === void 0 ? void 0 : _c.queryParams,
|
|
3819
3869
|
skipBrowserRedirect: true,
|
|
3820
3870
|
});
|
|
3871
|
+
flowId = urlFlowId;
|
|
3821
3872
|
return await _request(this.fetch, 'GET', url, {
|
|
3822
3873
|
headers: this.headers,
|
|
3823
3874
|
jwt: (_f = (_d = data.session) === null || _d === void 0 ? void 0 : _d.access_token) !== null && _f !== void 0 ? _f : undefined,
|
|
@@ -3829,13 +3880,16 @@ class GoTrueClient {
|
|
|
3829
3880
|
window.location.assign(data === null || data === void 0 ? void 0 : data.url);
|
|
3830
3881
|
}
|
|
3831
3882
|
return this._returnResult({
|
|
3832
|
-
data: { provider: credentials.provider, url: data === null || data === void 0 ? void 0 : data.url },
|
|
3883
|
+
data: { provider: credentials.provider, url: data === null || data === void 0 ? void 0 : data.url, flowId },
|
|
3833
3884
|
error: null,
|
|
3834
3885
|
});
|
|
3835
3886
|
}
|
|
3836
3887
|
catch (error) {
|
|
3837
3888
|
if (isAuthError(error)) {
|
|
3838
|
-
return this._returnResult({
|
|
3889
|
+
return this._returnResult({
|
|
3890
|
+
data: { provider: credentials.provider, url: null, flowId },
|
|
3891
|
+
error,
|
|
3892
|
+
});
|
|
3839
3893
|
}
|
|
3840
3894
|
throw error;
|
|
3841
3895
|
}
|
|
@@ -3878,7 +3932,7 @@ class GoTrueClient {
|
|
|
3878
3932
|
return this._returnResult({ data, error });
|
|
3879
3933
|
}
|
|
3880
3934
|
catch (error) {
|
|
3881
|
-
await
|
|
3935
|
+
await removePKCEVerifier(this.storage, this.storageKey, null);
|
|
3882
3936
|
if (isAuthError(error)) {
|
|
3883
3937
|
return this._returnResult({ data: { user: null, session: null }, error });
|
|
3884
3938
|
}
|
|
@@ -3983,7 +4037,7 @@ class GoTrueClient {
|
|
|
3983
4037
|
return isValidSession;
|
|
3984
4038
|
}
|
|
3985
4039
|
async _handleProviderSignIn(provider, options) {
|
|
3986
|
-
const url = await this._getUrlForProvider(`${this.url}/authorize`, provider, {
|
|
4040
|
+
const { url, flowId } = await this._getUrlForProvider(`${this.url}/authorize`, provider, {
|
|
3987
4041
|
redirectTo: options.redirectTo,
|
|
3988
4042
|
scopes: options.scopes,
|
|
3989
4043
|
queryParams: options.queryParams,
|
|
@@ -3993,7 +4047,7 @@ class GoTrueClient {
|
|
|
3993
4047
|
if (isBrowser() && !options.skipBrowserRedirect) {
|
|
3994
4048
|
window.location.assign(url);
|
|
3995
4049
|
}
|
|
3996
|
-
return { data: { provider, url }, error: null };
|
|
4050
|
+
return { data: { provider, url, flowId }, error: null };
|
|
3997
4051
|
}
|
|
3998
4052
|
/**
|
|
3999
4053
|
* Recovers the session from LocalStorage and refreshes the token
|
|
@@ -4341,7 +4395,7 @@ class GoTrueClient {
|
|
|
4341
4395
|
this.lastRefreshFailure = null;
|
|
4342
4396
|
this.suppressGetSessionWarning = false;
|
|
4343
4397
|
await removeItemAsync(this.storage, this.storageKey);
|
|
4344
|
-
await
|
|
4398
|
+
await removeAllPKCEVerifiers(this.storage, this.storageKey);
|
|
4345
4399
|
await removeItemAsync(this.storage, this.storageKey + '-user');
|
|
4346
4400
|
if (this.userStorage) {
|
|
4347
4401
|
await removeItemAsync(this.userStorage, this.storageKey + '-user');
|
|
@@ -4707,15 +4761,23 @@ class GoTrueClient {
|
|
|
4707
4761
|
* @param options.queryParams An object of key-value pairs containing query parameters granted to the OAuth application.
|
|
4708
4762
|
*/
|
|
4709
4763
|
async _getUrlForProvider(url, provider, options) {
|
|
4764
|
+
let redirectTo = options === null || options === void 0 ? void 0 : options.redirectTo;
|
|
4765
|
+
let codeChallenge = null;
|
|
4766
|
+
let codeChallengeMethod = null;
|
|
4767
|
+
let flowId = null;
|
|
4768
|
+
if (this.flowType === 'pkce') {
|
|
4769
|
+
;
|
|
4770
|
+
[codeChallenge, codeChallengeMethod, flowId] = await this._getCodeChallengeAndMethod();
|
|
4771
|
+
redirectTo = this._maybeAppendFlowIdToRedirect(redirectTo, flowId);
|
|
4772
|
+
}
|
|
4710
4773
|
const urlParams = [`provider=${encodeURIComponent(provider)}`];
|
|
4711
|
-
if (
|
|
4712
|
-
urlParams.push(`redirect_to=${encodeURIComponent(
|
|
4774
|
+
if (redirectTo) {
|
|
4775
|
+
urlParams.push(`redirect_to=${encodeURIComponent(redirectTo)}`);
|
|
4713
4776
|
}
|
|
4714
4777
|
if (options === null || options === void 0 ? void 0 : options.scopes) {
|
|
4715
4778
|
urlParams.push(`scopes=${encodeURIComponent(options.scopes)}`);
|
|
4716
4779
|
}
|
|
4717
|
-
if (
|
|
4718
|
-
const [codeChallenge, codeChallengeMethod] = await getCodeChallengeAndMethod(this.storage, this.storageKey);
|
|
4780
|
+
if (codeChallenge != null && codeChallengeMethod != null) {
|
|
4719
4781
|
const flowParams = new URLSearchParams({
|
|
4720
4782
|
code_challenge: `${encodeURIComponent(codeChallenge)}`,
|
|
4721
4783
|
code_challenge_method: `${encodeURIComponent(codeChallengeMethod)}`,
|
|
@@ -4729,7 +4791,27 @@ class GoTrueClient {
|
|
|
4729
4791
|
if (options === null || options === void 0 ? void 0 : options.skipBrowserRedirect) {
|
|
4730
4792
|
urlParams.push(`skip_http_redirect=${options.skipBrowserRedirect}`);
|
|
4731
4793
|
}
|
|
4732
|
-
return `${url}?${urlParams.join('&')}
|
|
4794
|
+
return { url: `${url}?${urlParams.join('&')}`, flowId };
|
|
4795
|
+
}
|
|
4796
|
+
/**
|
|
4797
|
+
* Appends the reserved flow id parameter to a redirect URL so the callback
|
|
4798
|
+
* can be matched to the verifier stored for its flow. Opt-in via
|
|
4799
|
+
* `experimental.appendPkceFlowIdToRedirects`: redirect URLs are validated
|
|
4800
|
+
* against the project's allow list including the query string, so an extra
|
|
4801
|
+
* parameter can stop exact (non-wildcard) entries from matching.
|
|
4802
|
+
*/
|
|
4803
|
+
_maybeAppendFlowIdToRedirect(redirectTo, flowId) {
|
|
4804
|
+
if (!redirectTo || !flowId || !this.experimental.appendPkceFlowIdToRedirects) {
|
|
4805
|
+
return redirectTo !== null && redirectTo !== void 0 ? redirectTo : undefined;
|
|
4806
|
+
}
|
|
4807
|
+
return appendFlowIdToRedirectTo(redirectTo, flowId);
|
|
4808
|
+
}
|
|
4809
|
+
/**
|
|
4810
|
+
* Generates and stores a PKCE challenge/verifier pair for a new flow,
|
|
4811
|
+
* logging any pending verifier the bounded slot ring evicts.
|
|
4812
|
+
*/
|
|
4813
|
+
async _getCodeChallengeAndMethod(isPasswordRecovery = false) {
|
|
4814
|
+
return getCodeChallengeAndMethod(this.storage, this.storageKey, isPasswordRecovery, (evictedFlowId) => this._debug('#_getCodeChallengeAndMethod()', 'evicted oldest pending PKCE verifier slot', evictedFlowId));
|
|
4733
4815
|
}
|
|
4734
4816
|
async _unenroll(params) {
|
|
4735
4817
|
try {
|