Skip to content

Commit 72aab65

Browse files
feedback
1 parent a97a154 commit 72aab65

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/web/src/ee/features/permissionSyncing/tokenRefresh.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const refreshLinkedAccountTokens = async (userId: string): Promise<Linked
3636
};
3737

3838
const doRefreshLinkedAccountTokens = async (userId: string): Promise<LinkedAccountErrors> => {
39+
// Only grab accounts that can be refreshed (i.e., have an access token, refresh token, and expires_at).
3940
const accounts = await prisma.account.findMany({
4041
where: {
4142
userId,
@@ -91,9 +92,9 @@ const doRefreshLinkedAccountTokens = async (userId: string): Promise<LinkedAccou
9192
// Only update refresh_token if a new one was provided.
9293
// This will preserve an existing refresh token if the provider
9394
// does not return a new one.
94-
...(refreshTokenResponse.refresh_token !== undefined && {
95+
...(refreshTokenResponse.refresh_token !== undefined ? {
9596
refresh_token: encryptOAuthToken(refreshTokenResponse.refresh_token),
96-
}),
97+
} : {}),
9798
expires_at,
9899
},
99100
});

0 commit comments

Comments
 (0)