capless / warrant

Python library for using AWS Cognito. With support for SRP.
Apache License 2.0
468 stars 192 forks source link

check_token() renew after access_token expired does not work #109

Open humanborg opened 6 years ago

humanborg commented 6 years ago

u = Cognito(pool_id, client_id, username=username, access_token=access_token, refresh_token=refresh_token) u.check_token()

This throws 'NotAuthorizedException', when access_token expired.

Per documentation: https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-with-identity-providers.html, using refresh_token (default 30 days after user authenticate) is valid we should be able to refresh the id and access_token.

Immortalin commented 5 years ago

@bjinwright any progress on this? Or is there any workarounds?

Zuiluj commented 4 years ago

Might be connected with the request that must be signed, although this does not require signed credentials. I'm looking into it right now. For the time being, try making the client request unsigned.

rednap commented 4 years ago

we're not getting new ID and auth tokens after an hour, looking here: https://github.com/capless/warrant/blob/master/warrant/__init__.py#L546

the authflow warrant is using is "REFRESH_TOKEN".

from aws docs: To use the refresh token to get new ID and access tokens with the user pool API, use the AdminInitiateAuth or InitiateAuth methods. Pass REFRESH_TOKEN_AUTH for the AuthFlow parameter.

happy to do a pull request if this is indeed an issue. cheers,

rednap commented 4 years ago

anyone reading this? Please regard my PR?