Skip to content

VW/Audi/Seat/Skoda: recover from marketing consent prompt#29980

Merged
andig merged 5 commits into
masterfrom
fix/vw-marketing-consent
May 17, 2026
Merged

VW/Audi/Seat/Skoda: recover from marketing consent prompt#29980
andig merged 5 commits into
masterfrom
fix/vw-marketing-consent

Conversation

@andig
Copy link
Copy Markdown
Member

@andig andig commented May 17, 2026

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 returns 200 OK with no Location header.

loginLegacy then parses the empty Location, parseAuthLocation returns empty url.Values, and the downstream token exchange fails with missing code:

ERROR creating vehicle foo failed: cannot create vehicle type 'audi': missing 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 OIDC callback URL 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:

[audi] DEBUG skipping optional marketing consent page
[audi] TRACE GET .../oidc/v1/oauth/client/callback/success?...&consentedScopes=openid+profile+mbb&...
...
Soc:             46%
Charge status:   C
Range:           22km
Odometer:        37160km

Login completes with consentedScopes=openid profile mbb only — no marketing scopes are granted.

Unit test added in consent_test.go. go build ./..., go test ./vehicle/vag/... and golangci-lint all pass.

Fixes #29760

🤖 Generated with Claude Code

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>
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • 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.
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.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

andig and others added 4 commits May 17, 2026 16:11
The request transport already logs all requests at trace level.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@andig andig changed the title Vehicle: recover from VW/Audi marketing consent prompt VW/Audi/Seat/Skoda: recover from marketing consent prompt May 17, 2026
@andig andig added the enhancement New feature or request label May 17, 2026
@andig andig enabled auto-merge (squash) May 17, 2026 14:15
@andig andig merged commit 5506053 into master May 17, 2026
13 checks passed
@andig andig deleted the fix/vw-marketing-consent branch May 17, 2026 14:18
@andig andig added the vehicles Specific vehicle support label May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request vehicles Specific vehicle support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request on marketing consent for all MEB based cars requires reboot of evcc regularly

1 participant