Salesforce Connector - Error on Token Refresh

Description

Description:

Every time the Salesforce Token that is used in Alfresco needs to be refreshed the action is failing and giving an error inside the Lightning component (see alfresco.log).

Analysis so far:
Alfresco sends the following request to Salesforce:

2021-01-05 09:17:43,986 DEBUG [org.springframework.web.client.RestTemplate] [http-nio-8080-exec-6] HTTP POST https://test.salesforce.com/services/oauth2/token
2021-01-05 09:17:43,986 DEBUG [org.springframework.web.client.RestTemplate] [http-nio-8080-exec-6] Accept=[application/x-www-form-urlencoded, multipart/form-data, application/json, application/*+json]
2021-01-05 09:17:43,987 DEBUG [org.springframework.web.client.RestTemplate] [http-nio-8080-exec-6] Writing [{refresh_token=[xyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyx], grant_type=[refresh_token]}] with org.springframework.http.converter.FormHttpMessageConverter

The request is successful and delivers all the information, but Salesforce is not sending a Content-Type header when using "application/x-www-form-urlencoded".
The response is then interpreted as application/octet-stream what could not be handled.

The logic for that is inside the spring-social-salesforce library Alfresco used. And it seem to be an already known error as you can see in the Github repo of the library.

https://github.com/jottley/spring-social-salesforce/blob/1.2.2.RELEASE/src/main/java/org/springframework/social/salesforce/connect/SalesforceOAuth2Template.java#L63

The Salesforce Connector is referencing an other version of that library, which does not have the fix for that behaviour available.

https://github.com/Alfresco/spring-social-salesforce/blob/release-1.2.2-alfresco-patched-20180410/src/main/java/org/springframework/social/salesforce/connect/SalesforceOAuth2Template.java

Could you please check if this could be added to the library Alfresco is using and also if its possible to switch to the other library as a workaround?

Environment

None

Testcase ID

None

Activity

Show:
Scott Ashcraft
March 31, 2021, 1:08 PM

please see above.

Jared Ottley
March 31, 2021, 1:07 PM

There is a plan to move to the upstream project in with our next release but again…see the above.

Jared Ottley
March 31, 2021, 1:06 PM

This hasn’t been reproduced in any of our testing. Can you ask them what type of Sandbox they are using? So we can try to match their environment?

Jared Ottley
January 14, 2021, 7:12 PM

While it hasn't been tested the upstream project should be compatible. All off the fixes/changes made in our fork were merged upstream a while ago.

We are still working on validating the other issues. They are either in progress or in our backlog of work.

This comment was left via Slack.

Marco Tonelli
January 13, 2021, 5:41 PM

The customer asked:
Are there more details yet on the open questions from my side or workarounds/fixes or is it still under review?

The original question about the workaround was :

Could you please check if this could be added to the library Alfresco is using and also if its possible to switch to the other library as a workaround?

Assignee

Marco Tonelli

Reporter

Marco Tonelli

Labels

None

Escalated By

None

Security Issue

None

ACT Numbers

01021412

Premier Customer

None

Code Branch

None

Build Location

None

Regression Since

None

Work Funnel End

None

Patch Attached

None

Dependent Version/s

None

Cloud or Enterprise

None

Prioritization Score

None

Delivery Team

None

Bug Priority

Category 3

Components

Fix versions

Affects versions