pmill / aws-cognito

A PHP library for AWS Cognito user pools
MIT License
74 stars 62 forks source link

Authenticate method does not handle challenge responses #3

Closed wallyholt closed 6 years ago

wallyholt commented 6 years ago

Library should handle Cognito challenge responses for things like 'NEW_PASSWORD_REQUIRED', 'SMS_MFA', etc. The 'authenticate' method currently only deals with a positive authentication response, but masks any requests from Cognito for additional information making it look like the authentication failed.

Details for response types is here: http://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminInitiateAuth.html#API_AdminInitiateAuth_ResponseSyntax

I produced the first case by adding a user to my new user pool from the Cognito user pool dashboard and setting a temporary password for the user.

Here is what the response looked like for that case:

screenshot 2017-12-28 19 21 12
pmill commented 6 years ago

Hello, sorry it'll be at least a few weeks before I can get to this, in the meantime feel free to submit a PR if you know the required code changes.

pmill commented 6 years ago

Hello, would you be able to give the code in the master branch a test, the 'authenticate' method should throw a ChallengeException now if a challenge response is required. And there is a new 'respondToChallenge' method that should allow you to send the response.

engharb commented 6 years ago

Hello @pmill,

I have installed your api via composer two days before and I am wondered that handleAuthenticateResponse() is not in CognitoClient class ?

pmill commented 6 years ago

@engharb can you create a new issue for your problem please.

pmill commented 6 years ago

This issue should be resolved now with the v0.2.0 release.