capless / warrant

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

How to print or save idtoke,access token and refresh token after authentication? #106

Closed phantom-j closed 6 years ago

phantom-j commented 6 years ago

Hi, i am using this method to authenticate

u = Cognito('your-user-pool-id','your-client-id', username='bob') u.authenticate(password='bobs-password')

It's not giving any error,but after that it's not printing anything,not even return value of u.authenticate() How to print idtoken,access token and refresh token?

humanborg commented 6 years ago

I think you can access it by u.id_token, u.access_token, u.refresh_token

ghost commented 6 years ago

Just incase you need more help, here is some code that will print the details you require on new lines in the shell :)

u = Cognito('your-user-pool-id','your-client-id',
username='bob')

u.authenticate(password='bobs-password')

return_value = f'ID token: {u.id_token} \nAccess Token: {u.access_token} \nRefresh Token: {u.refresh_token}'
print(return_value)
asitm9 commented 6 years ago

Hi below snippet will work for you

u = Cognito('your-user-pool-id','your-client-id',
username='bob')
u.authenticate(password='bobs-password')
print u.__dict__
phantom-j commented 6 years ago

Thanks guys, these methods are working.