eBay大中华区API开发者平台 开发者专区

搜 索
首页>API开发者平台>技术文档>我如何知道我的token是否过期?

技术文档

问题
我如何知道我的token是否过期?
解答
0
人觉得答案有帮助)
简单的方法是调用GeteBayOfficialTime来检查是否这个Token是有效的。如果您想获取Token具体的过期情况及状态,可以使用GetTokenStatus这个API
可能的状态有:
<?xml version="1.0" encoding="utf-8"?>
<GetTokenStatusResponse xmlns="urn:ebay:apis:eBLBaseComponents">
  <Timestamp>2011-01-31T22:55:18.773Z</Timestamp>
  <Ack>Success</Ack>
  <Version>705</Version>
  <Build>E705_CORE_BUNDLED_12630438_R1</Build>
  <TokenStatus>
    <Status>Active</Status>
    <EIASToken>nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wJnY+oC5iFog6dj6x9nY+seQ==</EIASToken>
    <ExpirationTime>2012-07-24T22:54:53.000Z</ExpirationTime>
  </TokenStatus>
</GetTokenStatusResponse>
Tokens need to be renewed every 18 months, else they expire
<?xml version="1.0" encoding="utf-8"?>
<GetTokenStatusResponse xmlns="urn:ebay:apis:eBLBaseComponents">
  <Timestamp>2011-01-31T22:51:48.113Z</Timestamp>
  <Ack>Success</Ack>
  <Version>705</Version>
  <Build>E705_CORE_BUNDLED_12630438_R1</Build>
  <TokenStatus>
    <Status>Expired</Status>
    <EIASToken>nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wMl4CiDZiKoA+dj6x9nY+seQ==</EIASToken>
    <ExpirationTime>2010-07-15T18:50:00.000Z</ExpirationTime>
  </TokenStatus>
</GetTokenStatusResponse>


<?xml version="1.0" encoding="utf-8"?>
<GetTokenStatusResponse xmlns="urn:ebay:apis:eBLBaseComponents">
  <Timestamp>2011-01-31T22:56:46.561Z</Timestamp>
  <Ack>Success</Ack>
  <Version>705</Version>
  <Build>E705_CORE_BUNDLED_12630438_R1</Build>
  <TokenStatus>
    <Status>RevokedByUser</Status>
    <EIASToken>nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wJnY+oC5iFog6dj6x9nY+seQ==</EIASToken>
    <ExpirationTime>2012-07-24T22:54:53.000Z</ExpirationTime>
    <RevocationTime>2011-01-31T22:56:33.000Z</RevocationTime>
  </TokenStatus>
</GetTokenStatusResponse>

<?xml version="1.0" encoding="utf-8"?>
<GetTokenStatusResponse xmlns="urn:ebay:apis:eBLBaseComponents">
  <Timestamp>2011-01-31T22:59:18.073Z</Timestamp>
  <Ack>Success</Ack>
  <Version>705</Version>
  <Build>E705_CORE_BUNDLED_12630438_R1</Build>
  <TokenStatus>
    <Status>RevokedByApp</Status>
    <EIASToken>nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wJnY+oC5iFog6dj6x9nY+seQ==</EIASToken>
    <ExpirationTime>2012-07-24T22:57:25.000Z</ExpirationTime>
    <RevocationTime>2011-01-31T22:59:01.000Z</RevocationTime>
  </TokenStatus>
</GetTokenStatusResponse>

答案对您有帮助吗?

是,对我很有帮助
否,没解决我的问题