title: Salesforce failed to complete task: Message: This session is not valid for use with the REST API
body: <p>I’m new in the development, and I’m facing an issue with salesforce connect app.
  We are using azure logic apps to integrate salesforce with Microsoft products, we had some processes in place working fine for the last few years but from last week all of them were disconnected, the error message being thrown is:</p>
  <blockquote>
  <p>&quot;status&quot;: 401,   &quot;message&quot;: &quot;Salesforce failed to complete task:
  Message: This session is not valid for use with the REST
  API\r\nclientRequestId: XXXXXXXXXX&quot;,   &quot;error&quot;: null,   &quot;source&quot;:
  &quot;Salesforce.Common&quot;,   &quot;errors&quot;: []</p>
  </blockquote>
  <blockquote>
  <p>code&quot;: &quot;Unauthorized&quot;,
  &quot;message&quot;: &quot;Failed to refresh access token for service: salesforce. Correlation Id=XXXXXXX, UTC TimeStamp=8/15/2022
  9:09:38 AM, Error: OAuth 2 access token refresh failed. Client ID and
  secret sent in form body. Response status code=BadRequest. Response
  body: '{&quot;error&quot;:&quot;invalid_grant&quot;,&quot;error_description&quot;:&quot;expired
  access/refresh token&quot;}'.</p>
  </blockquote>
  <p>I’ve reconnected azure with salesforce and granted all permission, including Perform requests at any time</p>
  <p><a href="https://i.stack.imgur.com/1PLUc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1PLUc.png" alt="Authorizing" /></a></p>
  <p>I had no luck, after a few minutes it disconnected again… so I installed the Azure Connected App, and refreshed the connection… still no luck, it keeps disconnecting throwing the same error message.</p>
  <p><a href="https://i.stack.imgur.com/7SR4I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7SR4I.png" alt="Connect App (managed)" /></a></p>
  <p>However, I kept getting disconnected from and getting the same error message.</p>
  <p>Any help would be much appreciated.</p>