@supabase/gotrue-js 2.107.0 → 2.108.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supabase/gotrue-js",
3
- "version": "2.107.0",
3
+ "version": "2.108.0",
4
4
  "private": false,
5
5
  "description": "Official SDK for Supabase Auth",
6
6
  "keywords": [
@@ -2595,15 +2595,28 @@ export default class GoTrueClient {
2595
2595
  const endpoint = `${this.url}/resend`
2596
2596
  if ('email' in credentials) {
2597
2597
  const { email, type, options } = credentials
2598
+ let codeChallenge: string | null = null
2599
+ let codeChallengeMethod: string | null = null
2600
+ if (this.flowType === 'pkce') {
2601
+ ;[codeChallenge, codeChallengeMethod] = await getCodeChallengeAndMethod(
2602
+ this.storage,
2603
+ this.storageKey
2604
+ )
2605
+ }
2598
2606
  const { error } = await _request(this.fetch, 'POST', endpoint, {
2599
2607
  headers: this.headers,
2600
2608
  body: {
2601
2609
  email,
2602
2610
  type,
2603
2611
  gotrue_meta_security: { captcha_token: options?.captchaToken },
2612
+ code_challenge: codeChallenge,
2613
+ code_challenge_method: codeChallengeMethod,
2604
2614
  },
2605
2615
  redirectTo: options?.emailRedirectTo,
2606
2616
  })
2617
+ if (error) {
2618
+ await removeItemAsync(this.storage, `${this.storageKey}-code-verifier`)
2619
+ }
2607
2620
  return this._returnResult({ data: { user: null, session: null }, error })
2608
2621
  } else if ('phone' in credentials) {
2609
2622
  const { phone, type, options } = credentials
@@ -2624,6 +2637,7 @@ export default class GoTrueClient {
2624
2637
  'You must provide either an email or phone number and a type'
2625
2638
  )
2626
2639
  } catch (error) {
2640
+ await removeItemAsync(this.storage, `${this.storageKey}-code-verifier`)
2627
2641
  if (isAuthError(error)) {
2628
2642
  return this._returnResult({ data: { user: null, session: null }, error })
2629
2643
  }
@@ -4711,7 +4725,7 @@ export default class GoTrueClient {
4711
4725
  if (isAuthRefreshDiscardedError(error)) {
4712
4726
  this._debug(debugName, 'refresh discarded by commit guard', error)
4713
4727
  } else {
4714
- console.error(error)
4728
+ this._debug(debugName, 'refresh failed', error)
4715
4729
 
4716
4730
  if (!isAuthRetryableFetchError(error)) {
4717
4731
  this._debug(
@@ -4,4 +4,4 @@
4
4
  // - Debugging and support (identifying which version is running)
5
5
  // - Telemetry and logging (version reporting in errors/analytics)
6
6
  // - Ensuring build artifacts match the published package version
7
- export const version = '2.107.0'
7
+ export const version = '2.108.0'