Skip to content

Commit b8b0ba6

Browse files
committed
Checkpoint
1 parent f722524 commit b8b0ba6

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

client-app/src/core/AuthModel.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,17 @@ export class AuthModel extends HoistAuthModel {
4242
XH.fetchService.addDefaultHeaders(async opts => {
4343
if (opts.url.startsWith('http')) return null;
4444

45-
const idToken = await this.client.getIdTokenAsync();
46-
return idToken ? {Authorization: `Bearer ${idToken.value}`} : null;
45+
try {
46+
const idToken = await this.client.getIdTokenAsync();
47+
return {Authorization: `Bearer ${idToken.value}`};
48+
} catch (e) {
49+
XH.suspendApp({
50+
message:
51+
'Your authentication has expired and you have been logged out of the app.' +
52+
'Please reload now to continue.',
53+
reason: 'AUTH_EXPIRED'
54+
});
55+
}
4756
});
4857

4958
// Finally, make a request to check the auth-status on the server - that call will include the id token header

0 commit comments

Comments
 (0)