• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / supabase-flutter / 28597364234
86%

Build:
DEFAULT BRANCH: main
Ran 02 Jul 2026 02:24PM UTC
Jobs 8
Files 81
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

02 Jul 2026 02:21PM UTC coverage: 85.93% (+0.01%) from 85.916%
28597364234

push

github

web-flow
fix(supabase_flutter): preserve hash routes and repeated query keys when clearing auth params (#1511)

## What

`removeAuthParametersFromUrl` cleans the auth parameters out of a URL
after a code exchange. It had two bugs that broke URLs it was supposed
to leave intact:

1. **Hash-based routes were corrupted.** The fragment was parsed with
`Uri.splitQueryString` and re-emitted as query parameters, so a route
like `#/dashboard` became `#%2Fdashboard`. Hash-based routing is Flutter
web's **default** URL strategy, so after a PKCE callback the app route
was mangled.
2. **Repeated query keys were dropped.** It read `queryParameters` (last
value wins), so `?tag=a&tag=b` collapsed to `?tag=b`.

Both contradict the function's own docstring ("preserving any unrelated
parameters").

## Why

```dart
// (1) fragment treated as a query string, then re-encoded
Uri.splitQueryString(currentUri.fragment)   // '/dashboard' -> {'/dashboard': ''}
// (2) last-wins map loses duplicates
Map<String, String>.of(currentUri.queryParameters)  // ?tag=a&tag=b -> {tag: b}
```

Fix:
- Use `queryParametersAll` so repeated keys are preserved.
- Only rewrite the fragment when it actually contains an auth parameter
(implicit flow: `#access_token=...`); otherwise preserve it verbatim so
routes aren't touched.

## Not a breaking change

Auth clearing is unchanged: the PKCE `code` in the query and
implicit-flow tokens in the fragment are still removed. Only
previously-corrupted output changes — hash routes and duplicate query
keys are now preserved.

## Tests

Extends `clear_auth_url_parameters_test.dart` (all 6 existing tests
still pass):
- `#/dashboard` is preserved (was `#%2Fdashboard`).
- `?tag=a&tag=b&code=abc123` → `?tag=a&tag=b` (was `?tag=b`).
- Implicit-flow tokens in the fragment are still cleared.

The two new bug tests fail on the current code and pass with the fix.
`dart format` and `dart analyze --fatal-warnings` are clean.

---------

Co-authored-by: Lukas Klingsbo <lukas.kl... (continued)

10 of 10 new or added lines in 1 file covered. (100.0%)

1 existing line in 1 file now uncovered.

4208 of 4897 relevant lines covered (85.93%)

3.97 hits per line

Coverage Regressions

Lines Coverage ∆ File
1
0.0
0.0% packages/supabase_flutter/lib/src/clear_auth_url_parameters_stub.dart
Jobs
ID Job ID Ran Files Coverage
8 supabase_flutter - 28597364234.8 02 Jul 2026 02:24PM UTC 11
79.57
GitHub Action Run
3 yet_another_json_isolate - 28433368938.3 30 Jun 2026 09:12AM UTC 1
79.03
GitHub Action Run
7 functions_client - 28444889808.7 30 Jun 2026 12:39PM UTC 2
98.57
GitHub Action Run
8 storage_client - 28533236058.8 01 Jul 2026 04:46PM UTC 5
92.98
GitHub Action Run
8 gotrue - 28536394514.8 01 Jul 2026 05:43PM UTC 27
84.74
GitHub Action Run
8 realtime_client - 28583270853.8 02 Jul 2026 10:32AM UTC 11
88.82
GitHub Action Run
6 postgrest - 28588548625.6 02 Jul 2026 12:07PM UTC 9
84.31
GitHub Action Run
7 supabase - 28588548625.7 02 Jul 2026 12:05PM UTC 15
81.8
GitHub Action Run
Source Files on build 28597364234
  • Tree
  • List 81
  • Changed 7
  • Source Changed 6
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #28597364234
  • 4fca4126 on github
  • Prev Build on main (#28588548625)
  • Next Build on main (#28599569004)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc