I'm trying to create a Custom Connector to an API endpoint that requires bearer tokens in the header for authentication.

In my Flow, I use a HTTP action to get a token, store it in a variable, and then pass it to my connector in the Authorization header. However, I always receive an Unauthorized error.

I receive this error when I test the connector on the custom connector test page:
{
"status": 400,
"source": "https://power-te-westus-1.azurewebsites.net:443/tokens/msmanaged-na/eum.2Dcreategroup.5F058fd1eee2b36bb6.5Fde5addbef9cce72c/shared-eum.2dcreateg-f412c0af-e8aa-49d6-9d10-76928018c41b/exchange",
"message": "Error from token exchange: Bad authorization token. Could not find identity for access token."
}
However, it succeeds when I use a HTTP action to make a call to the same endpoint as my custom connector. I use the same bearer token in the authorization header.
Is there a way I can get this to work as a Custom Connector?