Skip to content

Commit

Permalink
fix request param key
Browse files Browse the repository at this point in the history
  • Loading branch information
basak-akan committed Oct 8, 2023
1 parent db38dff commit 8fdb9c9
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/main/webapp/app/lti/lti13-exercise-launch.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class Lti13ExerciseLaunchComponent implements OnInit {
}

let requestBody = new HttpParams().set('state', state).set('id_token', idToken);
if (auth) requestBody = requestBody.set('auth', auth);
if (auth) requestBody = requestBody.set('authenticatedUser', auth);

this.http
.post('api/public/lti13/auth-login', requestBody.toString(), {
Expand All @@ -69,14 +69,18 @@ export class Lti13ExerciseLaunchComponent implements OnInit {
},
error: (error) => {
if (error.status === 401) {
this.loginService.logout(false);
// Subscribe to the authentication state to know when the user logs in
this.accountService.getAuthenticationState().subscribe((account) => {
if (account) {
// resend request when user logs in again
this.sendRequest();
}
});
if (this.accountService.isAuthenticated() && this.accountService.userIdentity?.login === auth) {
this.sendRequest();
} else {
this.loginService.logout(false);
// Subscribe to the authentication state to know when the user logs in
this.accountService.getAuthenticationState().subscribe((user) => {
if (user) {
// resend request when user logs in again
this.sendRequest();
}
});
}
} else {
window.sessionStorage.removeItem('state');
this.isLaunching = false;
Expand Down

0 comments on commit 8fdb9c9

Please sign in to comment.