GraphQL dropping authorization header

We have a Tyk REST API using OIC as it’s authorization method.
And I have a graphql API.
When using the playground I put in the authorization header, but the debug log shows “Key not authorized”. As best as I can tell Tyk’s GraphQL implementation isn’t passing the header to the API.

Has anyone been successful on using GraphQL and an auth header?

Adding some more details… We set up the GraphQL API with the same OIDC auth configuration.
Then on the data source I set header:
Authorization: {{ .request.headers.Authorization }}
per the documentation. I’m getting a different error now:

time="Jul 02 17:26:41" level=warning msg="JWT Invalid" api_id=24067ab67171442c5369d02cbd8bbb53 api_name="Communities Dev" error="Validation error. The 'Authorization' header did not have the correct format." mw=OpenIDMW org_id=5d5edc54fc99b200014228c1 origin= path="/v1/communities/"
time="Jul 02 17:26:41" level=warning msg="Attempted access with invalid key." api_id=24067ab67171442c5369d02cbd8bbb53 api_name="Communities Dev" key="****JWT]" mw=OpenIDMW org_id=5d5edc54fc99b200014228c1 origin= path="/v1/communities/"

Hi @ryoung, just to clarify a few things:

  1. Is the OIDC auth working in REST API? If not then you could check the claims of the token
  2. Is the Graph QL implementation based off the REST API and is it trying to pass the OIDC Authorization header value across to the REST API?

Client ==> GraphQL (OIDC auth mode) ==> REST API (OIDC auth mode)

  1. Yes, the OIDC is working with the rest API directly.
  2. That’s what I requested it to do. Do I have the correct conifguration for that? The error states the key is not in the correct format.

@ryoung Have you tried putting the Bearer prefix in front of the Auth value?

After trying a couple of tests with scenario in mind, I do not think it’s possible at this time. The UDG documentation deals with the query and response data
We will be glad if you can point us to anywhere in the docs that mentions request or headers in the data source for review
But as you suggested, Graph QL does not pass the auth header across to REST. I am talking to folks internally to know if there is way to do that
In the meantime, could you explain further on what you are trying to achieve?

Thanks for the response.
My configuration was lifted from is on the GraphQL configuration. documentation:

image|690x289

We are trying to pass along authorization headers to the upstream.

Appreciate the link and screenshot of the documentation. I will inform the internal team and update you as soon as possible.

Could you share the version of your gateway?

Our gateway version is v3.1.2

Just got back from the internal team. It appears the feature of injecting or parsing headers is only available from version 3.2.1 and above. Please follow our migration guide to 3.2 as there are some breaking changes

I tested it on the gateway 3.2.1 version and it works quite well. If you are migrating then please take note of the breaking changes as it could cause unforeseen issues.