diff --git a/src/app/authorize/components/form-authorize/form-authorize.component.html b/src/app/authorize/components/form-authorize/form-authorize.component.html
index 10d7449735..9a5464171a 100644
--- a/src/app/authorize/components/form-authorize/form-authorize.component.html
+++ b/src/app/authorize/components/form-authorize/form-authorize.component.html
@@ -133,6 +133,7 @@
i18n="@@authorize.authorize"
(click)="authorize()"
id="authorize-button"
+ [disabled]="loadingAuthorizeEndpoint"
>
Authorize access
diff --git a/src/app/authorize/components/form-authorize/form-authorize.component.ts b/src/app/authorize/components/form-authorize/form-authorize.component.ts
index 2a2c4556a1..8063db96c9 100644
--- a/src/app/authorize/components/form-authorize/form-authorize.component.ts
+++ b/src/app/authorize/components/form-authorize/form-authorize.component.ts
@@ -16,6 +16,7 @@ import {
takeUntil,
switchMap,
tap,
+ finalize,
} from 'rxjs/operators'
import { PlatformInfo, PlatformInfoService } from 'src/app/cdk/platform-info'
import { WINDOW } from 'src/app/cdk/window'
@@ -171,13 +172,23 @@ export class FormAuthorizeComponent implements OnInit, OnDestroy {
if (useAuthServerFlag === true) {
this._oauth
.authorizeOnAuthServer(this.oauthRequest, value)
+ .pipe(
+ take(1),
+ finalize(() => (this.loadingAuthorizeEndpoint = false))
+ )
.subscribe((redirectUrl) => {
this.redirectUrl.next(redirectUrl)
})
} else {
- this._oauth.authorize(value).subscribe((data) => {
- this.redirectUrl.next(data.redirectUrl)
- })
+ this._oauth
+ .authorize(value)
+ .pipe(
+ take(1),
+ finalize(() => (this.loadingAuthorizeEndpoint = false))
+ )
+ .subscribe((data) => {
+ this.redirectUrl.next(data.redirectUrl)
+ })
}
})
)