In this connection,
1, at present, my practice is to first store the Access_token and corresponding acquisition time to the database, to verify the current request time and the database is more than a certain time difference (6000s), if so, re-request Access_token, and re-store token and time, Otherwise, directly using the existing tokens in the database to request ticket;
2. Question: 1) Is it possible to request ticket multiple times? Is it as long as you don't ask for tokens many times?
2) The same token to request ticket will be different? What's the connection between token and ticket?
Thank you!
Reply content:
In this connection,
1, at present, my practice is to first store the Access_token and corresponding acquisition time to the database, to verify the current request time and the database is more than a certain time difference (6000s), if so, re-request Access_token, and re-store token and time, Otherwise, directly using the existing tokens in the database to request ticket;
2. Question: 1) Is it possible to request ticket multiple times? Is it as long as you don't ask for tokens many times?
2) The same token to request ticket will be different? What's the connection between token and ticket?
Thank you!
Through the "Public Platform Interface debugging tool" experience, the following conclusions are drawn:
1, the Public platform development document wrote:
Visible public platform to jsapi_ticket the number of calls and frequency restrictions, do not recommend frequent refresh Jsapi_ticket, but not refresh also not, followed by ticket for the api_ticket of the card coupon, JSSDK configuration used Jsapi_ticket For the ticket of two-dimensional code, the rules are consistent.
2, the same access_token multiple get ticket results consistent. However, it is recommended that you cache Access_token and ticket globally and set the corresponding expiration time. As for the difference between the two, I personally think:
Ticket is a call credential for an API, and to some extent it does not matter if it is compromised, and contains only specific permissions. And Access_token is the public number of the global unique interface call credentials, the public number calls each interface need to use Access_token, need to be properly kept. Ticket is the temporary credential generated by token. If re-acquired, the previous credential is invalidated.
If the summary is incorrect, please note.