appsmith icon indicating copy to clipboard operation
appsmith copied to clipboard

[Bug]: Salesforce Auth Token doesn't refresh automatically

Open NilanshBansal opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description

App Link: https://internal.appsmith.com/app/license-tracker/clients-645b6543a56f84769dcbc32d/edit Issue Description: https://theappsmith.slack.com/archives/CNQ9Q91C0/p1702972094026239

Steps To Reproduce

https://theappsmith.slack.com/archives/CNQ9Q91C0/p1702972094026239

Public Sample App

No response

Environment

Production

Issue video log

No response

Version

v1.9.59-SNAPSHOT

NilanshBansal avatar Jan 11 '24 10:01 NilanshBansal

Closing this completed. Please check epic https://github.com/appsmithorg/appsmith/issues/30826

sneha122 avatar Feb 08 '24 06:02 sneha122

Reopening this, as the issue is still reproducible on the production environment. cc: @tomjose92 @sneha122 @rohan-arthur

NilanshBansal avatar Feb 16 '24 12:02 NilanshBansal

Update: Tested by creating an app on Appsmith Cloud with 3 queries setting the token refresh time to 600 seconds. The app is working for the last 48 hrs. https://www.notion.so/appsmith/Salesforce-355d3963e05d4428b570b06e089a1001?pvs=4

NilanshBansal avatar Feb 27 '24 07:02 NilanshBansal

The salesforce refresh OAuth token flow was failing because the configuration for salesforce OAuth was not correctly done in Appsmith. The Send Scope With Refresh Token dropdown had to be set as No. I have added all the relevant information for configuring salesforce here. https://www.notion.so/appsmith/OAuth2-How-and-what-01c224ee730c4b77a79459256f0a4a9d?pvs=4#8f4bb462378b4e909c5f9e5a79029c8d

cc: @sneha122 @rohan-arthur

NilanshBansal avatar Feb 28 '24 10:02 NilanshBansal

The application has stopped working after 2 days hence reopening this issue.

Our hunch is that the current issue why apps are failing is due to this: https://salesforce.stackexchange.com/questions/65590/connected-app-avoiding-a-limit-on-a-number-of-issued-tokens-token-expiration The above question has 70 upvotes and is a widely faced issue with salesforce and we are facing the exact same behaviour. We are further drilling down onto this.

NilanshBansal avatar Feb 29 '24 10:02 NilanshBansal

Update: We are getting the same error from Salesforce after 1-2 days. Here is the screenshot of the error log from my local system. The logs are not informative enough. It is related to this https://github.com/appsmithorg/appsmith/issues/30239#issuecomment-1970802839 SCR-20240229-muy

NilanshBansal avatar Feb 29 '24 11:02 NilanshBansal

Had enabled the refresh token rotation in salesforce on 29th Feb, 2024 at 5 pm IST. The idea behind doing this is here

image (16)

NilanshBansal avatar Mar 01 '24 08:03 NilanshBansal

Update: After enabling the refresh token rotation in salesforce, the appsmith app is working fine since the last 20 hours.

The expires_in timeout in appsmith datasource configuration is set to 120 seconds. The usage count in the salesforce dashboard stands at 26 now. (Everytime the refresh token api is hit this count increases by 1).

SCR-20240301-j18

NilanshBansal avatar Mar 01 '24 08:03 NilanshBansal

Update: The appsmith app is working fine since the last 28 hours. The usage count in the salesforce dashboard has gone up to 77 now!

image

NilanshBansal avatar Mar 01 '24 16:03 NilanshBansal

Update: The appsmith app is working fine since the last 3 days.
The usage count stands at 85 now.

SCR-20240303-o4m

This marks the permanent fix for this issue! The salesforce-connected app is working perfectly fine auto refreshing the tokens.

NilanshBansal avatar Mar 03 '24 11:03 NilanshBansal