Having a problem working around authentication with password flow.
I've looked into this, and am now using no authentication and trying to call the token call manually.
The problem there is that Powerapps wants to send everything as json, and I cant seem to tell Powerapps that for that request I want just raw text.
The system I'm connecting to, for the token call is expecting something like this
So in short if I pass it as raw body it works.
How do I get powerapps to allow this?
Would it be possible to use concat function within PowerApps to combine the JSON into a string and then pass it through the connector?
For custom connector, the request is defined within the Request body, would you please share your OpenAPI file here?
Some colleauges and I built a custom connector that:
Let me know and I can share details here.
Hi @MarkIannucci ; sure thing.
- User enters information into the PowerApp and hits "Submit"
- A Flow kicks off that hits a Token Server and appends the users query information AND the token to a final call for data.
- Submit button OnSelect
ClearCollect( colFinalDataCall, finalDataCall.Run( queryParam1.Text, queryParam2.Text, queryParam3.Text, queryParam4.Text) )
- Build this for the DATA CALL (not the token call)
- Trigger: PowerApps
- Action1: HTTP Request TO THE TOKEN SERVER
- Action2: Parse JSON Response
- Action3: The Custom Connector you created earlier
- Use the Token parsed from Action1
- Action4: Response
- Use the Body (dynamic content) from the Custom Connector response
- Gotchas: IIRC, we had to do some cleanup of the Parsed JSON schema and Body schema sample payload.
- Been working like a charm for 6-8 months now
@ericonline , Thank you for your response on this, that looks like a pretty sweet solution. I'm guessing the token in your case is a part of the JSON that you're passing to the connection. Is that the case? In mine, I have to pass a bearer token in the authorization header and I've been banging my head against the wall trying to figure out how to variableize it.
I tried adding it as a custom header in the action:
And Flow got angry at me. Going to the detail you get this:
But unfortunately I haven't been able to pass the token value into the connection...
Hi @MarkIannucci ,
RE: "...I'm guessing the token in your case is a part of the JSON that you're passing to the connection.":
- To obtain the token ("Token call"), its a POST request to the token server using an HTTP action in Flow
- To use the token, yes, its passed as a parameter of the GET request to the data server using the Custom Connector in Flow
Just to clarify, are you required to get a token as part of each request (because they expire) or do you have a static token?
If static: Select `API Key` on the Custom Connector "Security" tab and paste it in.
If dyanamic: You might consider doing away with the Custom Connector all together and only using an HTTP action in Flow. I say this because you can pass Header values (your token obtained from a previous action).
I think this is the only way you can expose Headers.
Do you follow?
Looking a bit closer here... I wonder if you can surface the Auth Header in Flow if you select "API Key" in the Custom Connector "Security" tab. Might try that first.
Continue your learning in our online communities.
Tomorrow, September 18th at 8am PDT
Features releasing from October 2019 through March 2020
Coming to a city near you
Fill out a quick form to claim your user group badge now!
Connect, share, and learn with your peers year-round
Register by September 5 to save $200