question

seanerm avatar image
0 Likes"
seanerm asked

Renew token via the API

Hello, Is it to possible within an application to detect near expiry of a token, and request a new one via the API ?
token renew
10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

davidtsadler avatar image
1 Like"
davidtsadler answered
Sadly there is nothing in the API to automatically renew a token. If a token has expired, or you know it will in a few days, then a new token has to be generated from scratch. This means that you will have to take the user through the same process that they used to initially generate the token.
10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

davidtsadler avatar image
1 Like"
davidtsadler answered
Make a call to [GetTokenStatus]( http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetTokenStatus.html). As long as you have passed the token in the *RequesterCredentials.eBayAuthToken* field of the request the date and time that it will expire can be obtained by reading the [ExpirationTime]( http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetTokenStatus.html#Response.TokenStatus.ExpirationTime) field in the response. Another way of getting the same information is via the [HardExpirationWarning]( http://developer.ebay.com/DevZone/XML/docs/Reference/ebay/fieldindex.html#HardExpirationWarning) field that is returned in some of the API operations. For example [AddItem]( http://developer.ebay.com/DevZone/XML/docs/Reference/ebay/AddItem.html#Response.HardExpirationWarning). This information is returned within the 7-day period prior to a token's expiration. Once you know when a token is going to expire you can prompt a user to generate a new one before going through the authorisation process again.
10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

seanerm avatar image
0 Likes"
seanerm answered
Thanks for your answer. Once it is known that the token is expiring soon, is it possible to then automatically renew that token with the API?
10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

seanerm avatar image
0 Likes"
seanerm answered
Thanks, @davidtsadler
10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.