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

搜 索
首页>API开发者平台>技术文档>如何获取某个token的状态?

技术文档

问题
如何获取某个token的状态?
解答
0
人觉得答案有帮助)

简单的方法是调用GeteBayOfficialTime之类的API。调用成功则说明此token仍有效。如果你想获取expiration time之类更多的信息,可以尝试调用GetTokenStatus 

下示response展示了此API可返回的各种statuse

 

<?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>

 

答案对您有帮助吗?

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