0

How do I pass a token to a backend service from API management with this policy? I have a C# azure function (http-trigger) that acts like an api, to access it users need to have a valid jwt token, I have that working fine. but I cannot seem to send the jwt token to the backend service.

<policies>
<inbound>
    <validate-jwt header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized. Access token is missing or invalid.">
        <openid-config *******************************/>
        <audiences>
            <audience>***********************</audience>
        </audiences>
        <issuers>
            <issuer>******************</issuer>
        </issuers>
    </validate-jwt>
    <base />
</inbound>
<backend>
    <base />
</backend>
<outbound>
    <base />
</outbound>
<on-error>
    <base />
</on-error>
sschmeck
  • 7,233
  • 4
  • 40
  • 67
johnson dubula
  • 31
  • 1
  • 1
  • 7

2 Answers2

0

Have you considered forward-request to send your HTTP request to your backend service?

<backend>
  <forward-request />
</backend>
sschmeck
  • 7,233
  • 4
  • 40
  • 67
0

What worked was this

<value>@(context.Request.Headers.GetValueOrDefault("Authorization"))</value>
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
johnson dubula
  • 31
  • 1
  • 1
  • 7