matrix-org / matrix-org/matrix-js-sdk

Allow set `extraHeaders` when calling `completeAuthorizationCodeGrant`

Open Beginner friendly
#5,259 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-Developer-Experience O-Uncommon T-Enhancement
Dominant language
TypeScript
Stars
2.2k
Forks
704
Avg merge
1d 20h
Merged PRs (30d)
40

Description

Currently `matix-authentication-service` recognize device type by parsing the `User-Agent` request header when calling token exchange endpoint, while it can't recognize a Tauri App on MacOS (Tauri doesn't override user-agent by default like Electron, so it would results as a `Unknown device`.

`OidcClient:processSigninResponse` from `oidc-client-ts` already supports setting `extraHeaders`, it would be nice `completeAuthorizationCodeGrant` also accepts `extraHeaders` as a param.

Then I can customize my own header so that MAS will recognize it correctly:

```js
completeAuthorizationCodeGrant(
code,
state,
{
'User-Agent': 'MyApp/1.0.0'
}
)
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at completeAuthorizationCodeGrant and compare its parameter handling with oidc-client-ts's OidcClient:processSigninResponse, which already supports extraHeaders. Trace the authorization-code token exchange entry point and verify that supplied headers can reach it, including the custom User-Agent example described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, tauri, typescript
Domain
authentication
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.