2

I searched the database but failed to find any hints. I try to use my aws amplify graphql API with an external service, however, as my platform is secured by Cognito (email & PW) I need some elegant way to authenticate an existing Cognito user in a Userpool for the graphql API (Cognitor user = owner in DynamoDB) to make simple queries to retrieve infos to show in a webpage. Is there a simple way to do this without doing much? What options exist?

At the moment I get a Unathorised Message when I connect via URL in a browser.

{ "errors" : [ { "errorType" : "UnauthorizedException", "message" : "Valid authorization header not provided." } ] }

I am really missing the trick here.

OGi
  • 113
  • 1
  • 7
  • 1
    I tried to get a valid access token logging in with aws CLI and use postman Bearer Token to call my graphql interface using Bearer Token Authorization but I still get the fault. – OGi Feb 02 '21 at 09:57

1 Answers1

1

OK... after comparing the request headers I found the trick... Remove the "Bearer" prefix in Authorization.

OGi
  • 113
  • 1
  • 7
  • Can you explain in more detail? I'm having the same issue. – orome May 12 '22 at 19:17
  • Never mind, the solution is just to authenticate with "API Key" [with a key of](https://stackoverflow.com/a/39068444/656912) `x-api-key`. – orome May 14 '22 at 16:37