Update openid_credentials Widget API action for MSC1960 updates

We now need to send a `state` and `original_request_id` per MSC1960's recent adjustments
pull/21833/head
Travis Ralston 2020-09-05 15:06:31 -06:00
parent 7b1031d6a6
commit 355d8f5843
1 changed files with 8 additions and 1 deletions

View File

@ -186,7 +186,14 @@ export default class WidgetMessaging {
isUserWidget: this.isUserWidget,
onFinished: async (confirm) => {
const responseBody = {success: confirm};
const responseBody = {
// Legacy (early draft) fields
success: confirm,
// New style MSC1961 fields
state: confirm ? "allowed" : "blocked",
original_request_id: ev.requestId, // eslint-disable-line camelcase
};
if (confirm) {
const credentials = await MatrixClientPeg.get().getOpenIdToken();
Object.assign(responseBody, credentials);