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

supabase / supabase-py / 41635530197 / 8
98%
main: 98%

Build:
DEFAULT BRANCH: main
Ran 03 Nov 2026 12:28PM UTC
Files 18
Run time 0s
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

03 Nov 2026 12:25PM UTC coverage: 97.977%. Remained the same
41635530197.8

push

github

web-flow
fix(auth): read implicit grant params from the url fragment (#1923)

Fixes SDK-2670. Reopens the fix for SDK-1954 / #1664.

## Problem

`initialize(url=...)` and `initialize_from_url()` only read
`urlparse(url).query`. The implicit grant redirect from Supabase Auth
puts its parameters in the fragment
(`#access_token=...&refresh_token=...`, or
`#error=...&error_description=...` on failure). If you passed in the
real callback URL, nothing happened: you got no session, no `SIGNED_IN`
event and no error.

## Fix

A new private `_parse_url_params()` helper in `helpers.py` merges the
fragment and query parameters, and the query wins on conflicts. This
matches `parseParametersFromURL` in auth-js. `_is_implicit_grant_flow()`
and `_get_session_from_url()` both use it now. A PKCE callback
(`?code=...`) has no `access_token` or `error_description`, so it is
still not treated as an implicit grant.

## Relation to #1665

#1665 made the same change and was closed without being merged. It had
no review, no comments and no stated reason. Because of that, #1664 and
SDK-1954 were marked done while the bug is still on `main`. This PR
applies the same approach and adds wider test coverage.

## Tests

New tests in `tests/_async/test_initialize_from_url.py` (and the
generated sync version) mock HTTP with `httpx.MockTransport`, so they
need no infra:

- Tokens in the fragment produce a session and `SIGNED_IN`.
- `type=recovery` in the fragment also fires `PASSWORD_RECOVERY`.
- A fragment error redirect raises `AuthImplicitGrantRedirectError` with
its details.
- Query parameters win over fragment parameters.
- Query-only URLs keep working.
- A PKCE `?code=` callback is not treated as an implicit grant.

The four fragment tests fail on `main` and pass with this change. mypy
is clean.

1017 of 1038 relevant lines covered (97.98%)

0.98 hits per line

Source Files on job run-ubuntu-latest-3.13-functions - 41635530197.8
  • Tree
  • List 18
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 41635530197
  • de2c6fc5 on github
  • Prev Job for on main (#41635363760.21)
  • Next Job for on main (#41640930194.4)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc