Skip to content

Commit

Permalink
fix: renew JWT token to avoid its expiration - EXO-65633 (#75)
Browse files Browse the repository at this point in the history
Every one hour, the MS Office connector fails to connect to outlook agenda to retrieve events. This is because the token expires and is not renewed as expected due to a technical limitation on the MSAL.js as detailed in AzureAD/microsoft-authentication-library-for-js#4206
The current fix forces the renewal of the token on each usage of the MSAD.js
  • Loading branch information
ahamdi authored Aug 3, 2023
1 parent 8322b9e commit 2af449c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default {
return this.officeApi.loginPopup(this.loginRequest)
.then(loginResponse => getTokenPopup(this, loginResponse))
.then(tokenObject => {
const username = tokenObject && tokenObject.account && tokenObject.account.username;
const username = tokenObject?.account?.username;
this.user = username;
this.canPush = askWriteAccess;

Expand Down Expand Up @@ -195,6 +195,7 @@ function initOfficeConnector(connector) {
redirectUri: window.location.origin,
account: currentUser.username,
scopes: connector.CALENDAR_WRITE_SCOPE,
forceRefresh: true,
};

return officeApi.acquireTokenSilent(request)
Expand Down Expand Up @@ -573,4 +574,4 @@ function buildConnectorEvent(event) {
}

return connectorEvent;
}
}
2 changes: 1 addition & 1 deletion agenda-connectors-webapp/webpack.watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ module.exports = merge(webpackProductionConfig, {
path: path.resolve(`${exoServerPath}/webapps/${app}/`)
},
mode: 'development',
devtool: 'inline-source-map'
devtool: 'eval-source-map'
})

0 comments on commit 2af449c

Please sign in to comment.