syl20lego / insomnia-plugin-aws-cognito-token

Insomnia plugin for AWS Cognito
MIT License
44 stars 8 forks source link

Unable to get response #3

Closed karldanninger closed 4 years ago

karldanninger commented 4 years ago

Hi!

I followed the steps in the README and I'm getting this response:

{
  "message": "Authorization header requires 'Credential' parameter. Authorization header requires 'Signature' parameter. Authorization header requires 'SignedHeaders' parameter. Authorization header requires existence of either a 'X-Amz-Date' or a 'Date' header. Authorization=eyJraWQiOiJvNkdrc1czRTRkRjdXckFwWFJPWmRQSnFGdDQ3cXNNVTFUcEhGSGxPZG9JPSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiI5N2E1YzgzZS1iMjJkLTQxYzktYWQ5OC0yYWFmNzM4ZjMyZjkiLCJhdWQasdiOiI0dTIxMTRuY2M4YXJ1cmRpbHF0MjUzNTlobCIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJldmVudF9pZCI6IjRjYjI0Yzg4LTE4MjItNDcxNi04MTViLTNiODIxMGUzZjEzZSIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNTYyOTU1NjYzLCJpc3asdadMiOiJodHRwczpcL1wvY29nbml0by1pZHAudXMtZasdadWFzdC0xLmFtYXpvbmF3cy5jb21cL3VzLWVhc3QtMV9aU3NvR1NyUTYiLCJwaG9uZV9udW1iZXJfdmVyaWZpZWQiOmZhbHNlLCJjb2asdadduaXRvOnVzZXJuYW1lIjoia2FybGJpa2UxMjMiLCJleHAiOasdjE1NjI5NTkyNjMsImlhdCI6MTU2Mjk1NTY2MywiZW1haWwiOiJrYXJsQGRhbm5pbmdlci5jbyJ9.WdJWHvosyegUWSDgkpZeloeV0BRp1_5A_Ekwl20uuHxysmvtXfRE8xwhRRHkAZk6t1WcPkXWeEw-ClmXmUEs-Pasw-_u-uMjuHqpKnlk3iyb9jyasdad27H7ILTr0GcKE8-hr43vzGbcFT9xPkU-On1YYEtnk6E8n-zld6zNxEeKbKZ-d5-VjEYg2qK28qrN3IbIqvfd0i7CVJz1NN1sygjfJCvH96_unQlOH_DLNgSXtZ4STx3C9-r_vT_f9yApNMetXsrqwgZBGMezo8F-UDR8j-O8LD4tWUvr0AVcXxEY1CDRUY93uywOdu4Pj5kzCxi_DJ8NNSSZhtUHdo2kOS2Do1A"
}

Any ideas what is happening?

pethron commented 4 years ago

I have the same problem. From what I understand, this plugin returns the encoded JWT token while the Authorization header needs the plain version.

jeremyputeaux commented 4 years ago

I have the same problem. Did you find a solution?

jeremyputeaux commented 4 years ago

Ok I've found the solution. I was using IAM auth but this plugin is working when using Cognito auth.

In order to remove this message, you have to add Cognito auth as a secondary auth type in your AppSync conf. Then you have to add @aws_cognito_user_pools next to all the funtions and types in your schema as explained here. Be careful, once you do that, your default auth won't work anymore, so you have to add both on all of them. In my case @aws_iam.

Also, don't forget to update your VTL files because Cognito auth does not give you the same $context.identity content. You can find it here.

syl20lego commented 4 years ago

Hi Jeremy, yes I think that would explain the issue. The plugin is only for Cognito authentication. I think if you want to use IAM you can use the support 'AWS IAM v4' in Auth tab from Insomia directly without the need of the plugin.