Audi: rotate qmauth and add assertion headers for IDK token exchange#30292
Merged
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="vehicle/vag/idkproxy/endpoint.go" line_range="78-86" />
<code_context>
var res vag.Token
req, err := request.New(http.MethodPost, Config.TokenURL, strings.NewReader(data.Encode()), map[string]string{
- "Content-Type": request.FormContent,
- "Accept": request.JSONContent,
- "x-qmauth": qmauthNow(),
+ "Content-Type": request.FormContent,
+ "Accept": request.JSONContent,
+ "Accept-Charset": "utf-8",
+ "User-Agent": userAgent,
+ "x-qmauth": qmauthNow(),
+ "x-platform": "android",
+ "x-android-package-name": "de.myaudi.mobile.assistant",
+ "x-assertion": "0",
})
if err == nil {
</code_context>
<issue_to_address>
**suggestion:** Header set is duplicated between Exchange and Refresh; consider factoring into a helper
The header map here closely matches the one in `Refresh`. Please extract a shared helper (e.g. `qmHeaders() map[string]string`) or shared constant so both flows use the same header set and stay in sync when requirements change.
Suggested implementation:
```golang
qmSecret = "1ab69925ac179aaa4e83abe671a9476d176418b85bd706f1436ca15be647989c"
qmClientId = "01da27b0"
userAgent = "Android/4.31.0 (Build 800341641.root project 'myaudi_android'.ext.buildTime) Android/13"
)
func qmHeaders(qmAuth string) map[string]string {
return map[string]string{
"Content-Type": request.FormContent,
"Accept": request.JSONContent,
"Accept-Charset": "utf-8",
"User-Agent": userAgent,
"x-qmauth": qmAuth,
"x-platform": "android",
"x-android-package-name": "de.myaudi.mobile.assistant",
"x-assertion": "0",
}
}
```
```golang
req, err := request.New(http.MethodPost, Config.TokenURL, strings.NewReader(data.Encode()), qmHeaders(qmauthNow()))
```
```golang
req, err := request.New(http.MethodPost, Config.TokenURL, strings.NewReader(data.Encode()), qmHeaders(qmauthNow()))
```
I only see partial code. Anywhere else in `vehicle/vag/idkproxy/endpoint.go` (or related files) that constructs a `map[string]string` with this same header set (for the Exchange and Refresh flows) should be updated to call `qmHeaders(qmauthNow())` (or `qmHeaders(qmauth(ts))` if a timestamped value is used) instead of duplicating the header map literal. This keeps both flows in sync when headers change.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Closed
This was referenced May 28, 2026
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.
Fix #30280
Audi token exchange at
/auth/v1/idk/oidc/tokenstarted returning{"error":"invalid assertion headers"}because both the qmauth credentials and the expected assertion-header set rotated upstream. Values mirrored fromarjenvrh/audi_connect_haandTA2k/ioBroker.vw-connect, both currently active and in agreement.qmClientIdto01da27b0and the corresponding HMAC secretUser-Agent,Accept-Charset,x-platform,x-android-package-name,x-assertion: 0on Exchange and Refresh so refresh doesn't regress an hour after login