Skip to content

fix(auth): use the new My Porsche app callback URL - #100

Merged
fredriklj merged 1 commit into
CJNE:mainfrom
schaepi85:fix/auth0-callback-url
Nov 14, 2026
Merged

fredriklj merged 1 commit into
CJNE:mainfrom
schaepi85:fix/auth0-callback-url

Conversation

@schaepi85

Copy link
Copy Markdown
Contributor

Problem

Since about 2026-11-05 every login fails. The stored refresh token is rejected, and the fallback full login stops at get_and_extract_location_params() with PorscheExceptionError("Could not fetch authorization code"). GET /authorize returns 403 unauthorized_client: Callback URL mismatch, because Porsche removed my-porsche-app://auth0/callback from the app client's allowed callbacks.

Reported in CJNE/ha-porscheconnect#465 and CJNE/ha-porscheconnect#466.

Fix

The client_id (XhygisuebbrqQ80byOuU5VncxLIm8E6H) is unchanged. The current My Porsche Android app (de.porsche.one 21.26.46-row+195601) passes an HTTPS app link to WebAuthProvider...withRedirectUri(...):

https://security.porsche.com/auth/en-GB/app/callback

This PR switches REDIRECT_URI to that URL and bumps USER_AGENT to the current app build. No other code changes.

The app's custom-scheme fallback (feature toggle access_login_redirect_uri_use_custom_scheme, my-porsche-app-auth0://auth0/callback) is not whitelisted either, so I didn't use it. Only the en-GB path is registered; de-DE etc. return 403.

Testing

  • /authorize with PKCE through this branch's OAuth2Client.get_and_extract_location_params() returns 302 to /u/login/identifier. Before the change it returned 403.
  • Full flow tested with these constants against a real EU account (Macan GTS): identifier, captcha, password, resume, code, /oauth/token, GET /connect/v1/vehicles, vehicle measurements, and refresh_token (which also rotates the refresh token). It has been running in Home Assistant (ha-porscheconnect 0.1.12, HA 2026.11.1) since then.
  • ruff check / ruff format --check are clean.

Existing installs need one fresh login after the upgrade (the old refresh token is dead), e.g. Reconfigure in ha-porscheconnect.

Porsche removed my-porsche-app://auth0/callback from the allowed
callbacks of the app client, so /authorize returns 403
"Callback URL mismatch" and every login fails before the identifier
step. The current app (de.porsche.one 21.26.46) uses the same client_id
with the https://security.porsche.com/auth/en-GB/app/callback app link.

Also bump the user agent to match the current app build.

Refs CJNE/ha-porscheconnect#465, CJNE/ha-porscheconnect#466
@fredriklj

Copy link
Copy Markdown
Collaborator

Great work! Thanks.

@fredriklj
fredriklj merged commit 6934991 into CJNE:main Nov 14, 2026
1 check passed
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.

2 participants