Skip to content

Commit a232316

Browse files
authored
feat(ui): handle fragment auth callback (#5791)
1 parent 137da27 commit a232316

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

ui/src/app/views/auth/callback/callback.component.ts

+11-4
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,21 @@ export class CallbackComponent implements OnInit, OnDestroy {
4343
this.loading = true;
4444
}
4545

46-
ngOnDestroy(): void {} // Should be set to use @AutoUnsubscribe with AOT
46+
ngOnDestroy(): void { } // Should be set to use @AutoUnsubscribe with AOT
4747

4848
ngOnInit() {
4949
this.paramsSub = this._route.params.subscribe(params => {
5050
this.consumerType = params['consumerType'];
5151

52-
this.code = this._route.snapshot.queryParams.code || this._route.snapshot.queryParams.token;
53-
this.state = this._route.snapshot.queryParams.state || this._route.snapshot.queryParams.request;
52+
let queryParams = this._route.snapshot.queryParams;
53+
if (this._route.snapshot.fragment) {
54+
const dus = new DefaultUrlSerializer();
55+
const parsed = dus.parse(this._route.snapshot.fragment);
56+
queryParams = parsed.queryParams;
57+
}
58+
59+
this.code = queryParams.code || queryParams.token;
60+
this.state = queryParams.state || queryParams.request;
5461

5562
if (!this.code || !this.state) {
5663
this.loading = false;
@@ -70,7 +77,7 @@ export class CallbackComponent implements OnInit, OnDestroy {
7077
this.loading = false;
7178
this.showCTL = true;
7279
this._cd.markForCheck();
73-
})
80+
});
7481
return;
7582
}
7683

0 commit comments

Comments
 (0)