matrix-org / matrix-org/matrix-js-sdk
Allow set `extraHeaders` when calling `completeAuthorizationCodeGrant`
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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