Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Connector Development
Answered

Custom Connector for Salesforce with OAuth 2.0 Issues

(0) ShareShare
ReportReport
Posted on by 25

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-d733fdb9-6108-4199-b4f5-06e99b02d10f

 

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-Token-Issue/td-p/194982

 

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!

Categories:
  • scriptkat Profile Picture
    25 on at
    Re: Custom Connector for Salesforce with OAuth 2.0 Issues

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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 770 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 494

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 399

Featured topics