ArranJacques / laravel-aws-cognito-auth

An authentication driver for Laravel for authenticating users in AWS Cognito User Pools.
Other
74 stars 26 forks source link

Authentication issue #18

Closed DavitBurnazyan closed 5 years ago

DavitBurnazyan commented 6 years ago

Hello,

I have upgraded Laravel version from 5.2 -> to 5.6 step by step. I integrated this package, and when trying to do authentication I get this error:

Error executing "AdminInitiateAuth" on "https://cognito-idp.ap-southeast-1.amazonaws.com"; AWS HTTP error: Client error: POST https://cognito-idp.ap-southeast-1.amazonaws.com resulted in a 400 Bad Request response: {"type":"InvalidSignatureException","message":"The request signature we calculated does not match the signature you pr (truncated...) InvalidSignatureException (client): The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details. - {"type":"InvalidSignatureException","message":"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details."}

Please help me understand what might cause this error. Thanks.

ArranJacques commented 6 years ago

Hi

This could be to do with the your IAM user. Make sure you've given them the correct policies in order to access AWS Cognito. I think AmazonCognitoDeveloperAuthenticatedIdentities should do it but if it doesn't work try attaching the other Cognito related policies to.

Once your IAM user is set up with the correct policies attached make sure you've added the Access key ID and Secret access key correctly in the config/aws.php file.

Also make sure you've added your AWS Cognito User Pool's id, and User Pool App's client-id correctly in the config/aws-cognito-auth.php file.

My guess is that there is something wrong with these settings or how your IAM user is set up which is causing the request signatures to be incorrect.

I hope that helps.