Questions about the Access_token and ticket of WeChat

Source: Internet
Author: User
Tags ticket
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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.