Seller Central
Seller Forums

Amazon Seller Forums » Login With Amazon » Questions about Login With Amazon

Thread: Is there a way to manually expire an access token, for testing purposes?
Thread Archived This thread has been archived - replies are not allowed.


This question is answered.


Permlink Replies: 3 - Pages: 1 - Last Post: 04 Apr, 2017 2:48 PM by: Anurag S. (LWA) Threads: [ Previous | Next ]
Rob Moncur

Posts: 4
Registered: 17 Sep, 16 8:32 PM
Posted on: 23 Mar, 2017 8:44 PM  
Click to report abuse...
Is there a way to manually expire an access token, for testing purposes?

I'm building an iOS app and have been having trouble testing how the app will behave after my access token is expired (and when the app will get a new access token). Having to wait an hour every time I want to run another test makes it really hard to do testing and take a really long time to fix a couple of bugs I have.

Any tips or tricks on how to do this best?

--Rob
Is this a helpful question? Yes 0   No
3 Replies
Sort replies by:
Rahul Singh

Posts: 3
Registered: 09 Mar, 15 10:53 PM
Posted on: 28 Mar, 2017 2:21 PM   in response to: Rob Moncur in response to: Rob Moncur  
Click to report abuse...
Hi Rob

We don't provide any utility to manually invalidate the access token. The access token once generated is valid for 1 hour and can be used to get user profile data.

On a slightly related note, Login with Amazon iOS sdk http://login.amazon.com/ios provides apis to authorize and fetch Authorize result AMZNAuthorizeResult which contains accessToken and user's profile data. The exchange for accessToken to user profile data is taken care by the sdk internally.

Can you clarify your use case as to what you are using the accessToken for?

Thanks
Rahul

Was this reply helpful? Yes 0   No 0
Rob Moncur

Posts: 4
Registered: 17 Sep, 16 8:32 PM
Posted on: 28 Mar, 2017 2:35 PM   in response to: Rahul Singh in response to: Rahul Singh  
Click to report abuse...
I'm using the access token with AWS Cognito. After I give Cognito the access token, it can then assume a role, getting temporary credentials for the app to interact with AWS (storing data in S3).

Because Cognito needs a valid access token, I need to update Cognito with the valid access token every time it expires and is rotated. I do a check every time the app starts or makes a request to make sure the current access token is valid, and will update it with Cognito if a new token is granted.

I'm trying to test the apps behavior when it detects that the access token is expired, then requests a new one to supply to Cognito. I'm having issues with this flow right now. Since I have to wait an hour for the token to expire, it makes this a very long process.

Does this make sense? Is there a better way to do this? Am I missing something?

--Rob

PS - I also with there was some call in the SDK to determine if the current token is still active and when it will expire. That would help me.

Was this reply helpful? Yes 0   No 0
Anurag S. (LWA)

Posts: 23
Registered: 16 Oct, 14 12:50 AM
Posted on: 04 Apr, 2017 2:48 PM   in response to: Rob Moncur in response to: Rob Moncur  
Click to report abuse...
Hi Rob,
Thanks for providing more details about your setup.

Although we don’t currently have a better solution for forcing the token expiration for testing purposes, we’ve taken note of your request and will consider developing one in the future. We appreciate the input.
However, whenever you request a token from the Login with Amazon SDK for iOS, it will always return a valid token. It will fetch a fresh new token automatically if needed, to keep things simple on your side.

Thanks,
Anurag
Login with Amazon
Was this reply helpful? Yes 1   No 0