VW/Audi/Seat/Skoda: recover from marketing consent prompt#29980
Merged
Conversation
MEB-based cars (Audi, VW, Skoda, Cupra) periodically have a marketing consent page injected into the identity login flow. The redirect chain then ends on a `.../consent/marketing/...` page returning 200 with no Location header, so login silently yields empty url.Values and the token exchange fails with "missing code". A restart does not help because the prompt reappears on every login. Detect the marketing consent interstitial and continue the login without consenting by following the OIDC callback embedded in the consent request URL. evcc now recovers automatically instead of requiring a manual restart after the owner accepts or rejects the prompt in the app. Also adds trace logging to the identity login flow for easier diagnosis of future login regressions. Fixes #29760 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new TRACE logging in
Login/loginNewlogs the fulluri, which may include sensitive query parameters; consider using the existingRedacted()helper or otherwise stripping secrets before logging for consistency with other log messages. - Marketing consent detection currently relies on
strings.Contains(u.Path, "/consent/marketing/"); it might be more robust to match against an exact or anchored path pattern to avoid accidentally treating other endpoints containing that substring as consent pages.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new TRACE logging in `Login`/`loginNew` logs the full `uri`, which may include sensitive query parameters; consider using the existing `Redacted()` helper or otherwise stripping secrets before logging for consistency with other log messages.
- Marketing consent detection currently relies on `strings.Contains(u.Path, "/consent/marketing/")`; it might be more robust to match against an exact or anchored path pattern to avoid accidentally treating other endpoints containing that substring as consent pages.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
The request transport already logs all requests at trace level. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Cars on the VW MEB platform (Audi, VW, Skoda, Cupra) periodically have a marketing consent page injected into the identity login flow ("Einwilligung in personalisierte Kommunikation"). When this happens, the identity server's redirect chain ends on a
.../signin-service/v1/consent/marketing/...page that returns200 OKwith noLocationheader.loginLegacythen parses the emptyLocation,parseAuthLocationreturns emptyurl.Values, and the downstream token exchange fails withmissing code:A restart does not help — the consent prompt reappears on every login until the owner manually accepts or rejects it in the app/website. This is the recurring "needs a reboot" condition reported in #29760.
Fix
Detect the marketing consent interstitial (
.../consent/marketing/...final URL) and continue the login without consenting by following the OIDCcallbackURL embedded in the consent request — equivalent to the "not now" path. evcc now recovers automatically.Applied to both the legacy and the new VW identity login flows.
Also adds trace logging to the identity login flow for easier diagnosis of future login regressions.
Verification
Tested live against the myAudi API with an account currently showing the marketing consent prompt:
Login completes with
consentedScopes=openid profile mbbonly — no marketing scopes are granted.Unit test added in
consent_test.go.go build ./...,go test ./vehicle/vag/...andgolangci-lintall pass.Fixes #29760
🤖 Generated with Claude Code