Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pkce): 20111 PKCE auth flow does not return user to previous path like dex auth flow #20202

Merged
merged 12 commits into from
Oct 30, 2024
Prev Previous commit
Next Next commit
Handle the promise of a subscription
Signed-off-by: austin5219 <3936059+austin5219@users.noreply.github.com>
  • Loading branch information
austin5219 committed Oct 17, 2024
commit 4070e08fa903c8062f5674e5da4c328c0f95b383
18 changes: 14 additions & 4 deletions ui/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,18 @@ export class App extends React.Component<
this.navigationManager = new NavigationManager(history);
this.navItems = navItems;
this.routes = routes;
this.popupPropsSubscription = null;
this.unauthorizedSubscription = null;
services.extensions.addEventListener('systemLevel', this.onAddSystemLevelExtension.bind(this));
}

public async componentDidMount() {
this.popupPropsSubscription = this.popupManager.popupProps.subscribe(popupProps => this.setState({popupProps}));
this.unauthorizedSubscription = this.subscribeUnauthorized();
this.popupManager.popupProps.subscribe(popupProps => this.setState({popupProps})).then((subscription) => {
this.popupPropsSubscription = subscription;
});
this.subscribeUnauthorized().then((subscription) => {
this.unauthorizedSubscription = subscription;
});
const authSettings = await services.authService.settings();
const {trackingID, anonymizeUsers} = authSettings.googleAnalytics || {trackingID: '', anonymizeUsers: true};
const {loggedIn, username} = await services.users.get();
Expand Down Expand Up @@ -151,8 +157,12 @@ export class App extends React.Component<
}

public componentWillUnmount() {
this.popupPropsSubscription.unsubscribe();
this.unauthorizedSubscription.unsubscribe();
if (this.popupPropsSubscription) {
this.popupPropsSubscription.unsubscribe();
}
if (this.unauthorizedSubscription) {
this.unauthorizedSubscription.unsubscribe();
}
}

public render() {
Expand Down
Loading