Refresh tokens
Refresh tokens
02 Apr 2017, 12:58
Hello, according to this page:
https://connect.spotware.com/docs/api-reference/oauth-services-description
when you get the error message about access tokens, you should request new tokens
questions:
1. what is the error message / code that identifies the message as a "need to refresh tokens" message?
would it be one of these?
"UNKNOWN_ERROR" "UNSUPPORTED_MESSAGE" "INVALID_REQUEST" "TIMEOUT_ERROR" "ENTITY_NOT_FOUND" "CANT_ROUTE_REQUEST" "FRAME_TOO_LONG" "CONCURRENT_MODIFICATION" "MARKET_CLOSED" "TRADING_DISABLED"
or something else?
2. does the refresh token itself ever expire?
Replies
mindbreaker
03 Apr 2017, 12:01
RE: RE:
ycomp said:
mindbreaker said:
Save time (timestamp - php function: time() ) when you create token and then add expired time (286666) in seconds and you know wen token will expire (it is 30 days time).
so I can just request a new token @ 29 days and all is good?
Even that day in which the token was generated (Always you can refresh token) old token will work until expire
@mindbreaker
mindbreaker
04 Apr 2017, 21:49
RE:
ycomp said:
I'd still like to know how to handle the error message when the token is about to expire. That way I won't have to keep track of when the token was initially generated (which I would prefer not to have to do)
Test it! its my old token: g0gjr3jzeaNqsPXx-AaHv6Ef_SH9E0jRoU8Ut03hmzw
{"error":{"errorCode":"CH_ACCESS_TOKEN_INVALID","description":"Invalid access token"}}
@mindbreaker
ycomp
05 Apr 2017, 10:31
RE: RE:
mindbreaker said:
ycomp said:
I'd still like to know how to handle the error message when the token is about to expire. That way I won't have to keep track of when the token was initially generated (which I would prefer not to have to do)
Test it! its my old token: g0gjr3jzeaNqsPXx-AaHv6Ef_SH9E0jRoU8Ut03hmzw{"error":{"errorCode":"CH_ACCESS_TOKEN_INVALID","description":"Invalid access token"}}
thanks - for me this was a stumbing block.. I didn't have any old tokens )
@ycomp
mindbreaker
05 Apr 2017, 12:10
Error messages (bottom of the page):
https://connect.spotware.com/docs/api-reference/accounts-api
@mindbreaker
mindbreaker
02 Apr 2017, 17:18
Save time (timestamp - php function: time() ) when you create token and then add expired time (286666) in seconds and you know wen token will expire (it is 30 days time).
@mindbreaker