Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.

Commit 558aef7

Browse files
committed
Refactors acquireTokenErrorCallBack
1 parent e5b754d commit 558aef7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/app/authentication/authentication.component.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,16 @@ export class AuthenticationComponent extends GraphExplorerComponent {
3636

3737
public async ngOnInit() {
3838
// Register Callbacks for redirect flow
39-
app.handleRedirectCallback(this.acquireTokenCallBack, this.acquireTokenErrorCallBack);
39+
app.handleRedirectCallback((error, response) => {
40+
if (error) {
41+
this.acquireTokenErrorCallBack(error);
42+
} else {
43+
AppComponent.explorerValues.authentication.status = 'authenticated';
44+
this.displayUserProfile();
45+
this.setPermissions(response);
46+
}
47+
});
48+
4049
AppComponent.explorerValues.authentication.status = 'anonymous';
4150

4251
const prevVersion = localStorage.getItem('version');
@@ -162,7 +171,7 @@ export class AuthenticationComponent extends GraphExplorerComponent {
162171
* We only want to change the authentication status to anonymous for errors other than those
163172
* that require interation from the user.
164173
*/
165-
if (!requiresInteraction(error.errorCode) || error.errorCode !== 'acquiretoken_progress_error') {
174+
if (!requiresInteraction(error.errorCode) && error.errorCode !== 'acquiretoken_progress_error') {
166175
AppComponent.explorerValues.authentication.status = 'anonymous';
167176
}
168177
}

0 commit comments

Comments
 (0)