Skip to content

Commit d9ba120

Browse files
committed
Fix OAuth connect/revoke flows
1 parent c845470 commit d9ba120

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/Umbraco.Cms.Integrations.Crm.Dynamics/Client/src/config/authorization/authorization-property-editor.element.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ export class DynamicsAuthorizationElement extends UmbElementMixin(LitElement){
101101
};
102102
this._showSuccess("OAuth Connected");
103103

104+
await this.#dynamicsContext.checkOauthConfiguration();
105+
104106
const { data } = await this.#dynamicsContext.getSystemUserFullName();
105107
this._userName = data;
106108

src/Umbraco.Cms.Integrations.Crm.Dynamics/Client/src/modal/dynamics-form-modal.element.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ export default class DynamicsFormModalElement extends UmbModalBaseElement<Dynami
5757
async #checkOAuthConfiguration() {
5858
if (!this.#settingsModel) return;
5959

60-
if (!this.#settingsModel.isAuthorized) {
61-
this._showError("Unable to connect to Dynamics. Please review the settings of the form picker property's data type.");
62-
} else {
60+
if (this.#settingsModel.isAuthorized) {
6361
await this.#getForms();
6462
}
6563
}
@@ -102,6 +100,15 @@ export default class DynamicsFormModalElement extends UmbModalBaseElement<Dynami
102100
});
103101
}
104102

103+
async #onConnect() {
104+
await this.#getForms();
105+
}
106+
107+
async #onRevoke() {
108+
this._filteredForms = [];
109+
await this.#dynamicsContext.checkOauthConfiguration();
110+
}
111+
105112
onMessageOnSubmitIsHtmlChange() {
106113
this.renderWithIFrame = !this.renderWithIFrame;
107114
this.toggleLabel = !this.renderWithIFrame ? "Render with Script" : "Render with iFrame";
@@ -157,7 +164,7 @@ export default class DynamicsFormModalElement extends UmbModalBaseElement<Dynami
157164
<br />
158165
159166
<uui-box headline="Dynamics - OAuth Status">
160-
<dynamics-authorization></dynamics-authorization>
167+
<dynamics-authorization @connect=${this.#onConnect} @revoke=${this.#onRevoke}></dynamics-authorization>
161168
</uui-box>
162169
`}
163170

0 commit comments

Comments
 (0)