Skip to content

fix(auth): clear local session on signout failures#2504

Merged
mandarini merged 1 commit into
supabase:masterfrom
pjpjq:fix/clear-session-on-offline-signout
Jul 7, 2026
Merged

fix(auth): clear local session on signout failures#2504
mandarini merged 1 commit into
supabase:masterfrom
pjpjq:fix/clear-session-on-offline-signout

Conversation

@pjpjq

@pjpjq pjpjq commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Replaces #2503, which was closed when the fork branch was renamed from codex/... to fix/....

Description

Fixes #2501.

signOut() previously returned immediately when the remote logout request produced a retryable/network auth error. For global and local sign-out scopes that meant the persisted browser/device session remained in storage, so an offline sign-out could reject while leaving the user locally authenticated.

This PR keeps the existing others semantics, but ensures global and local scopes always clear the current local session before returning the remote logout error.

Testing

  • pnpm install --frozen-lockfile
  • pnpm --dir packages/core/auth-js exec jest --config jest.config.js test/GoTrueClient.signOut.test.ts --runInBand --silent=false
  • pnpm nx build auth-js
  • pnpm prettier --check packages/core/auth-js/src/GoTrueClient.ts packages/core/auth-js/test/GoTrueClient.signOut.test.ts
  • pnpm exec eslint packages/core/auth-js/test/GoTrueClient.signOut.test.ts
  • git diff --check

Note: pnpm exec eslint packages/core/auth-js/src/GoTrueClient.ts ... is currently blocked by pre-existing lint errors in GoTrueClient.ts (unused variables / no-empty-object-type outside this diff), so I linted the new test file directly and relied on pnpm nx build auth-js for the changed source file.

@pjpjq
pjpjq requested review from a team as code owners July 7, 2026 04:45
@pkg-pr-new

pkg-pr-new Bot commented Jul 7, 2026

Copy link
Copy Markdown

Open in StackBlitz

@supabase/auth-js

npm i https://pkg.pr.new/@supabase/auth-js@2504

@supabase/functions-js

npm i https://pkg.pr.new/@supabase/functions-js@2504

@supabase/postgrest-js

npm i https://pkg.pr.new/@supabase/postgrest-js@2504

@supabase/realtime-js

npm i https://pkg.pr.new/@supabase/realtime-js@2504

@supabase/storage-js

npm i https://pkg.pr.new/@supabase/storage-js@2504

@supabase/supabase-js

npm i https://pkg.pr.new/@supabase/supabase-js@2504

commit: ccec346

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 71.595% (-8.7%) from 80.309% — pjpjq:fix/clear-session-on-offline-signout into supabase:master

@mandarini mandarini left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@mandarini
mandarini merged commit 314cca0 into supabase:master Jul 7, 2026
28 checks passed
mandarini pushed a commit to supabase/ssr that referenced this pull request Jul 10, 2026
This PR updates `@supabase/supabase-js` to v2.110.2.

**Source**: supabase-js-stable-release

---

## Release Notes

## v2.110.2

## 2.110.2 (2026-07-09)

### 🩹 Fixes

- **auth:** clear local session on signout failures
([#2504](supabase/supabase-js#2504))

### ❤️ Thank You

- Luc Peng

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
mandarini pushed a commit to supabase/supabase that referenced this pull request Jul 14, 2026
This PR updates @supabase/*-js libraries to version 2.110.5.

**Source**: supabase-js-stable-release

**Changes**:
- Updated @supabase/supabase-js to 2.110.5
- Updated @supabase/auth-js to 2.110.5
- Updated @supabase/realtime-js to 2.110.5
- Updated @supabase/postgest-js to 2.110.5
- Refreshed pnpm-lock.yaml

---

## Release Notes

## v2.110.5

## 2.110.5 (2026-07-14)

### 🩹 Fixes

- **supabase:** avoid edge runtime warning
([#2522](supabase/supabase-js#2522))

### ❤️ Thank You

- Vaibhav @7ttp
## v2.110.4

## 2.110.4 (2026-07-14)

### 🩹 Fixes

- **functions:** stop sending API key in Authorization header for
function calls
([#2511](supabase/supabase-js#2511))
- **realtime:** encode broadcast header fields as UTF-8
([#2516](supabase/supabase-js#2516))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- Pedro Henrique
## v2.110.3

## 2.110.3 (2026-07-13)

### 🩹 Fixes

- **auth:** preserve pkce verifier
([#2513](supabase/supabase-js#2513))
- **postgrest:** pin tstyche target off floating latest
([#2509](supabase/supabase-js#2509))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- Vaibhav @7ttp
## v2.110.2

## 2.110.2 (2026-07-09)

### 🩹 Fixes

- **auth:** clear local session on signout failures
([#2504](supabase/supabase-js#2504))

### ❤️ Thank You

- Luc Peng

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
mandarini pushed a commit to supabase/supabase that referenced this pull request Jul 15, 2026
This PR updates @supabase/*-js libraries to version 2.110.6.

**Source**: supabase-js-stable-release

**Changes**:
- Updated @supabase/supabase-js to 2.110.6
- Updated @supabase/auth-js to 2.110.6
- Updated @supabase/realtime-js to 2.110.6
- Updated @supabase/postgest-js to 2.110.6
- Refreshed pnpm-lock.yaml

---

## Release Notes

## v2.110.6

## 2.110.6 (2026-07-15)

### 🩹 Fixes

- **postgrest:** type hinted self-referencing embeds as arrays
([#2520](supabase/supabase-js#2520))
- **realtime:** forward opts to send() in track()
([#2490](supabase/supabase-js#2490))
- **supabase:** warn instead of throw for unrecognized sb_ API key
subtypes ([#2526](supabase/supabase-js#2526))

### ❤️ Thank You

- Franco Kaddour @FrancoKaddour
- Katerina Skroumpelou @mandarini
## v2.110.5

## 2.110.5 (2026-07-14)

### 🩹 Fixes

- **supabase:** avoid edge runtime warning
([#2522](supabase/supabase-js#2522))

### ❤️ Thank You

- Vaibhav @7ttp
## v2.110.4

## 2.110.4 (2026-07-14)

### 🩹 Fixes

- **functions:** stop sending API key in Authorization header for
function calls
([#2511](supabase/supabase-js#2511))
- **realtime:** encode broadcast header fields as UTF-8
([#2516](supabase/supabase-js#2516))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- Pedro Henrique
## v2.110.3

## 2.110.3 (2026-07-13)

### 🩹 Fixes

- **auth:** preserve pkce verifier
([#2513](supabase/supabase-js#2513))
- **postgrest:** pin tstyche target off floating latest
([#2509](supabase/supabase-js#2509))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- Vaibhav @7ttp
## v2.110.2

## 2.110.2 (2026-07-09)

### 🩹 Fixes

- **auth:** clear local session on signout failures
([#2504](supabase/supabase-js#2504))

### ❤️ Thank You

- Luc Peng

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

auth-js: signOut() throws before clearing local session when offline (all scopes, including 'local')

3 participants