Skip to content

Commit

Permalink
fix: refresh token issue in salesforce (integration-os#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
oberoi-gaurav authored Aug 20, 2024
1 parent d0fa9e4 commit c1baf77
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion integrationos-oauth/src/connections/salesforce/refresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export const refresh = async ({ body }: DataObject): Promise<OAuthResponse> => {
data: { access_token: accessToken, token_type: tokenType },
} = response;

let refreshToken = refresh_token;
if (response.data.refresh_token) {
refreshToken = response.data.refresh_token;
}

// Get expiry time through introspection
const introspection = await axios({
url: `${baseUrl}/introspect`,
Expand All @@ -51,7 +56,7 @@ export const refresh = async ({ body }: DataObject): Promise<OAuthResponse> => {

return {
accessToken,
refreshToken: refresh_token,
refreshToken,
expiresIn,
tokenType,
meta: {
Expand Down

0 comments on commit c1baf77

Please sign in to comment.