Showing results for 
Search instead for 
Did you mean: 
Advocate IV
Advocate IV

undefinedError from token exchange: Bad authorization header scheme

I am attempting to create a custom connector to a 3rd party provider and use Flow to send over data.  Their API uses tokens when making calls, but the tokens are SINGLE USE.  So the pattern is:
Send Auth information.  Get Token
Make Call using Token.

Send Auth information.  Get Token
Make Call using Token.


Not brilliant.


I used swagger hub and can make calls successfully.  When I try to test the Custom Connector I can make the Auth call but the Lookup call fails with the error about a Token Exchange.



Security Tab - No Authentication
API doesn't work because the Authorization token changes every single call.  Can't cache anything.


Definition Tab -
Auth Token - Post -   Body of message is {API Key, UserName, Password}

LookupEmployees - Get - 2 Query parameters and the Header should be Authorization: BDToken <value>


Testing the Calls -

Auth Token works.  The request is sending along a Bearer token which it shouldn't but its not failing so <shrug>

Auth Request.png


And it returns a token as expected.

 Auth Response.png


I copy the token into the Lookup Employees call and it fails.  They relabel token to BDToken in their call but it gets pasted in correctly.  The Bearer token from the above step goes away and the query string parameters (disp, SearchDate) are sent along as expected.

 Lookup Request.png


But the response is a failure because of the 'Token Exchange'.  Which I'm not familiar with.

Lookup Response.png


To prove the call does work, I generated a new token and called the same endpoint in Swagger - the date is encoded the same, disp is still complete and the header has the BDToken.






Any suggestions I can test?


Community Support
Community Support

Hi @bbrazeau,


How is your swagger file configured? Please share more details on your swagger file.

Have you tried to create a custom connector form a Postman collection?

Please take the following doc for more details:


Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I've made the current swagger API public so you can view it online as I can't attach files.


Its a rough draft as I'm attempting to prove I can make round trips before building all of the end points.  While you won't be able to get data back, the calls can be tried showing the parameters sent etc.


I attempted to create a custom connector via postman output from the link.  I am able to make the Authorization call to get a token, but the call to get Employees is still failing.  It works in Postman, just not in the custom connector.  The Postman Connector definition has the query string parameters, but it does not include a field to set the Header Token value ("Authorization").  The Token is in the postman.json file, but its not surfaced in the custom connector.  I can send along the json or provide links to the custom connectors if that helps.


Here is a snippet of the postman.json file for the GetEmployee call

	"requests": [
			"id": "15fb28a7-6189-4cae-9302-cdafa4fdb412",
			"name": "Get Employees",
			"url": "",
			"description": "Get list of Employees",
			"headerData": [
					"key": "Authorization",
					"value": "BDToken NmNhZjQ....Mg==",
					"description": "",
					"enabled": true
			"method": "GET",
			"pathVariableData": [],
			"queryParams": [
					"key": "disp",
					"value": "complete",
					"equals": true,
					"description": "",
					"enabled": true
					"key": "searchdate",
					"value": "9/18/2018",
					"equals": true,
					"description": "",
					"enabled": true

Postman created connector - Header is not surfaced so I can't set the value -

BD - No Header.png


In the Swagger Custom Connector the Header for Authorization is visible.

BD - Header.png


I've attempted to test the (Swagger created) connector in a flow


In that example I can make the call and generate a token. Calling GetEmployees and sending along the Token fails. Because it returns 'unauthorized' the run history won't even show what was sent so troubleshooting there is impossible.




Helpful resources

Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Kudoed Authors
Users online (3,256)