Skip to content

Commit

Permalink
Enhancement: Handle refresh token not working on expiry is set to null
Browse files Browse the repository at this point in the history
  • Loading branch information
brijeshgajjarfynd committed Jul 18, 2024
1 parent d962cca commit e1a2e31
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v0.7.7] - 2024-07-19
### Changed
- Handle refresh token not working for token which has expiry as `null`.
---
## [v0.7.6] - 2024-07-11
### Changed
- Exported `apiRoutes` as `platformApiRoutes`. The `apiRoutes` export will be deprecated in the next major release.
- Optimized webhook subscription by reducing unnecessary API calls.

---
## [v0.7.5] - 2024-06-19
### Changed
Expand Down
4 changes: 2 additions & 2 deletions express/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ class Extension {
platformConfig.oauthClient.setToken(session);
platformConfig.oauthClient.token_expires_at = session.access_token_validity;

if (session.access_token_validity && session.refresh_token) {
let ac_nr_expired = ((session.access_token_validity - new Date().getTime()) / 1000) <= 120;
if (!session.access_token_validity || session.refresh_token) {
let ac_nr_expired = !session.access_token_validity? true: ((session.access_token_validity - new Date().getTime()) / 1000) <= 120;
if (ac_nr_expired) {
logger.debug(`Renewing access token for company ${companyId} with platform config ${logger.safeStringify(platformConfig)}`);
const renewTokenRes = await platformConfig.oauthClient.renewAccessToken(session.access_mode === 'offline');
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
},
"name": "@gofynd/fdk-extension-javascript",
"description": "FDK Extension Helper Library",
"version": "0.7.6",
"version": "0.7.7",
"main": "index.js",
"directories": {
"example": "examples"
Expand Down

0 comments on commit e1a2e31

Please sign in to comment.