Skip to content

Commit a0cf462

Browse files
rustyconoverclaude
andcommitted
Request offline access for external frontend OAuth redirects (v0.6.8)
When return_to is set, add access_type=offline and prompt=consent to the authorization URL so Google returns a refresh_token. This lets external frontends (e.g. DuckDB WASM) silently refresh expired id_tokens. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d63343e commit a0cf462

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "vgi-rpc"
3-
version = "0.6.7"
3+
version = "0.6.8"
44
description = "Vector Gateway Interface - RPC framework based on Apache Arrow"
55
readme = "README.md"
66
requires-python = ">=3.13"

vgi_rpc/http/_oauth_pkce.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ def process_response(
719719
)
720720

721721
# Build authorization URL
722-
params = {
722+
params: dict[str, str] = {
723723
"response_type": "code",
724724
"client_id": self._client_id,
725725
"redirect_uri": self._redirect_uri,
@@ -728,6 +728,12 @@ def process_response(
728728
"state": state_nonce,
729729
"scope": self._scope,
730730
}
731+
# When redirecting to an external frontend, request offline access so
732+
# Google returns a refresh_token. DuckDB WASM needs this to silently
733+
# refresh expired id_tokens without user interaction.
734+
if return_to:
735+
params["access_type"] = "offline"
736+
params["prompt"] = "consent"
731737
auth_url = f"{authorization_endpoint}?{urlencode(params)}"
732738

733739
logger.debug("OAuth PKCE redirect to %s (original: %s)", authorization_endpoint, original_url)

0 commit comments

Comments
 (0)