We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f722524 commit b8b0ba6Copy full SHA for b8b0ba6
1 file changed
client-app/src/core/AuthModel.ts
@@ -42,8 +42,17 @@ export class AuthModel extends HoistAuthModel {
42
XH.fetchService.addDefaultHeaders(async opts => {
43
if (opts.url.startsWith('http')) return null;
44
45
- const idToken = await this.client.getIdTokenAsync();
46
- return idToken ? {Authorization: `Bearer ${idToken.value}`} : null;
+ try {
+ 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
+ }
56
});
57
58
// Finally, make a request to check the auth-status on the server - that call will include the id token header
0 commit comments