cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
scriptkat
Frequent Visitor

Custom Connector for Salesforce with OAuth 2.0 Issues

Hello Everyone,

 

My organization is using SSO for our Salesforce instance, so I am unable to use the OOTB Salesforce Connector. Instead, I have created a Custom Connector that uses an OAuth 2.0 flow with a Connected App i've set up within Salesforce. When I test the connection, the initial connection succeeds with no issues, and I can also verify this in the Salesforce user logs. However, when I try to test an Operation, I am getting:

[{
"message": "Session expired or invalid",
"errorCode": "INVALID_SESSION_ID"
}]

 

It is difficult for me to tell where the breakdown is occurring, as the Operation request is calling the azure-apihub.us with an access token that does not correspond to the Salesforce access token. I've followed the Microsoft troubleshooting steps here to confirm that my OAuth 2.0 settings are configured correctly: https://support.microsoft.com/en-us/topic/verifying-oauth-configuration-for-custom-connectors-d733fd...

 

I am able to obtain an access token using the same configuration patterns I am setting in my Custom Connector, and use it to make the equivalent 'Operations' (API Requests) in Postman. I am therefore stumped and not sure where else I may be able to look to determine where the problem may be in the flow. Any help would be greatly appreciated. I will post my sanitized settings, maybe someone is able to see something that I cannot.

 

Here is my Connector security configuration. Just a note: I am having to use Generic OAuth 2.0 as the Identity Provider instead of Salesforce, as the Salesforce Identity Provider throws an unknown exception with Salesforce after I complete the SSO flow. This issue was also reported here, with what looks like a working resolution: https://powerusers.microsoft.com/t5/Connecting-To-Data/Custom-Connector-to-Salesforce-and-Refresh-To...

 

scriptkat_0-1626470890285.png

Here is the definition of my Operation:

scriptkat_1-1626470983053.png

 


Here is the response:

scriptkat_2-1626471033900.png

 

Verification that Connection is Connected:

scriptkat_3-1626471178070.png

 

 

Here are my Connected App settings, if it helps (i've confirmed I can communicate with the Connected App using Postman, and the initial Connection establishes correctly with the Connected App):

scriptkat_4-1626471285208.png

 

Any and all help appreciated - thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Syndicate_Admin
Administrator
Administrator

I found the following links that may be helpful. From the last link:

 

"There is a setting in Salesforce that may lead to issues where calls return “INVALID_SESSION_ID – Session expired or invalid”. If this is occurring, clear the the Session Setting Lock sessions to the IP address from which they originated check box."

 

https://powerusers.microsoft.com/t5/Connecting-To-Data/Custom-Connector-to-Salesforce-and-Refresh-To...

https://docs.microsoft.com/en-us/answers/questions/58928/salesforce-connection-fails-after-success.h...

https://help.openconnectors.ext.hana.ondemand.com/home/what-causes-invalid-session-id-messages

 

If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION ☑️. If you find this reply helpful, please consider giving it a LIKE 👍.

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

I found the following links that may be helpful. From the last link:

 

"There is a setting in Salesforce that may lead to issues where calls return “INVALID_SESSION_ID – Session expired or invalid”. If this is occurring, clear the the Session Setting Lock sessions to the IP address from which they originated check box."

 

https://powerusers.microsoft.com/t5/Connecting-To-Data/Custom-Connector-to-Salesforce-and-Refresh-To...

https://docs.microsoft.com/en-us/answers/questions/58928/salesforce-connection-fails-after-success.h...

https://help.openconnectors.ext.hana.ondemand.com/home/what-causes-invalid-session-id-messages

 

If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION ☑️. If you find this reply helpful, please consider giving it a LIKE 👍.

View solution in original post

This fixed my issue; thank you so much for the second set of eyes!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (1,363)