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

Getting access_token when using on-premise data gateway in the custom connector

How can we pass the current logged in power apps user's access_token to a custom connector?
Custom connector connects to internally hosted APIs via the data gateway.

Context:
Client has a canvas app which does CRUD operations with an external system, facilitated by usage of a custom connector and APIs.
All the APIs are internal (not exposed via the internet). So the custom connector connects via on-prem data gateway.
Shidin_0-1643744878505.jpeg

 

 
The limitation of enabling that check-box is that we seem to be limited in our Authentication types to the below 3 options.
Shidin_1-1643744878513.jpeg

 

 
The APIs we are consuming are role-based. So they need to know + validate who the calling user is (via the JWT access_token). That's the use case.
 
Trying to see if any of the following scenarios work:
  1. Get the user's access_token from the Power App and then pass it to the API as a HTTP header.
    (Might be able to pull it off using a Power Automate flow)
  2. If #1 is not possible, then make the APIs public and with OAuth 2.0 auth, which will solve the problem. But if the APIs are made public, we need to go through security reviews and pen tests, which I am trying to avoid.
Thanks in advance!
2 REPLIES 2
Dinesh
Advocate III
Advocate III

 

I am not sure about getting the user's token from canvas app. But you can try to simulate the steps of Oauth flow using HTTP connector without creating custom connector.

 

1. Generate an access token depending on the API setup with HTTP call

2. Using the new token in the header for the actual API calls

JonPowerApps
Frequent Visitor

Did you ever resolve this? 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,792)