matrix-org / matrix-org/matrix-js-sdk
provide way to handle M_CONSENT_NOT_GIVEN
- Dominant language
- TypeScript
- Stars
- 2.2k
- Forks
- 704
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 40
Description
**Describe the bug**
When registering a new guest user via matrix-js-sdk, I get an error `M_CONSENT_NOT_GIVEN` asking me to accept the term of Matrix. Unfortunately, I can't find any way to get this URL directly in `matrix-js-sdk` (for instance to display this form to the user to sign).
**To Reproduce**
Load this script after putting the SDK in `lib/browser-matrix.min.js`.
```
Merlin-Peres Magic Square
class MatrixClient {
constructor(matrix_instance="https://matrix.org", room_id="!ThqzNEDFDpeWJYEObP:matrix.org") {
this.matrix_instance = matrix_instance
this.room_id = room_id
}
async start() {
const tmpClient = window.matrixcs.createClient(this.matrix_instance);
const { user_id, device_id, access_token } = await tmpClient.registerGuest()
console.log("access_token: ",access_token)
this.client = window.matrixcs.createClient({ baseUrl: this.matrix_instance,
accessToken: access_token,
userId: user_id,
deviceId: device_id})
this.client.setGuest(true);
await this.client.startClient({initialSyncLimit: 10})
console.log("Client started!")
this.client.on("sync", (state, prevState, result) => {
console.log("On sync: State %s -> %s", prevState, state)
console.log("On sync: Result: %j", result)
this.client.joinRoom(this.room_id).then(function() {
console.log("Joined %s", roomId);
});
})
}
}
matrixClient = new MatrixClient()
matrixClient.start()
```
**Expected behavior**
I expect to have a way to handle `M_CONSENT_NOT_GIVEN`.
Contributor guide
Research direction
Start at the registerGuest() call in the provided browser script and trace how the SDK exposes registration errors, especially M_CONSENT_NOT_GIVEN. Check the browser bundle entry point referenced as lib/browser-matrix.min.js and identify the consent URL or handling information available there. Done means a guest registration flow can obtain and handle the consent requirement for the user.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- api, authentication
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100