Skip to content

Commit 80a262f

Browse files
authored
Merge pull request #159 from htrc/98-widgets-not-getting-displayed-after-the-user-is-logged-in-for-a-while
98 widgets not getting displayed after the user is logged in for a while
2 parents d68874d + 4360b42 commit 80a262f

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
- Fix widgets not getting displayed after user refresh token expires by signing out user. [#98](https://github.com/htrc/torchlite-frontend/issues/98)
12+
13+
## [0.2.1] – 2025-01-29
14+
1015
### Added
11-
- Google Tag Manager code [#156](https://github.com/htrc/torchlite-frontend/issues/156)
16+
- Google Analytics code [#156](https://github.com/htrc/torchlite-frontend/issues/156)
1217

1318
## [0.2.0] – 2025-01-06
1419

@@ -32,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3237
- This CHANGELOG file.
3338
- Share button and popup [#61](https://github.com/htrc/torchlite-app/issues/61)
3439

35-
[unreleased]: https://github.com/htrc/torchlite-frontend/compare/0.2.0...HEAD
36-
[0.1.0]: https://github.com/htrc/torchlite-frontend/compare/0.2.0...0.1.0
37-
[0.2.0]: https://github.com/htrc/torchlite-frontend/releases/tag/0.2.0
40+
[unreleased]: https://github.com/htrc/torchlite-frontend/compare/0.2.1...HEAD
41+
[0.2.1]: https://github.com/htrc/torchlite-frontend/compare/0.2.0...0.2.1
42+
[0.2.0]: https://github.com/htrc/torchlite-frontend/compare/0.1.0...0.2.0
43+
[0.1.0]: https://github.com/htrc/torchlite-frontend/releases/tag/0.1.0

src/pages/api/auth/[...nextauth].tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import jwt_decode, { JwtPayload } from 'jwt-decode';
77
import { AuthInfo } from 'types/auth';
88
import { v4 as uuidv4 } from 'uuid';
99
import { deleteSession, getSessionAuthInfo, setSessionAuthInfo, setSessionExpiration } from 'utils/database';
10+
import { signIn } from 'next-auth/react';
1011

1112
const keycloak = KeycloakProvider({
1213
clientId: process.env.KEYCLOAK_CLIENT_ID || '',
@@ -65,6 +66,10 @@ async function refreshAccessToken(token: JWT): Promise<JWT> {
6566

6667
await deleteSession(token.sessionId);
6768

69+
// Ref: https://github.com/htrc/torchlite-frontend/issues/98
70+
// This is a temporary fix, and we may need to revisit how NextAuth is implemented/refactor code for better exception handling.
71+
await signIn();
72+
6873
return {
6974
...token,
7075
error: 'RefreshAccessTokenError'

0 commit comments

Comments
 (0)