WeChat Development (I) application interface and token acquisition, token acquisition

Source: Internet
Author: User

Development (1) application interface and token acquisition


Author: Songyang

This article is from Ashura road and is prohibited for commercial purposes. For more information, see the source.

Link: http://blog.csdn.net/fansongy/article/details/43233369






Apply for developers

Log onto the public platform and click the Developer Center on the left to apply to become a developer.

You can see the Developer Center interface, which includes AppId and AppSecret. Currently, the AppSecret is partially hidden. If you want to view the complete version, you need to bind your mobile phone and brush the QR code. This looks safe.

Get Access_token

In order not to expose the automatic AppId and AppSecret, we need to use an access_token to the server.GETMethod to access the following URL:

https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET

Parameter description

Parameters Required? Description
Grant_type Yes Obtain access_token and enter client_credentia
Appid Yes Unique third-party user credential
Secret Yes The unique credential key of a third-party user, that is, appsecret

The returned result is Json:

{    "access_token": "G4TT9jG3Y3S3pK4rBMxuCHFgRdo56SQKpC8WKv_4-rIeJ0UwnOaN9t8DCoIyKgSDAVAIKdV2cveWZ--oOEvsoYGy1jBTicXWQCgq2SHdo-Y",    "expires_in": 7200}

This access_token can be used by our server to request various information from the server. The relevant documentation is here

Access interface

List of server IP addresses as test requests.

Access:

https://api.weixin.qq.com/cgi-bin/getcallbackip?access_token=ACCESS_TOKEN

Replace ACCESS_TOKEN with the text requested in the previous step. We can see that a Json is returned:

{    "ip_list": [        "101.226.62.77",        "101.226.62.78",        "101.226.62.79",        "140.207.54.77",        "140.207.54.78",        "140.207.54.79",        "140.207.54.80"    ]}

These are the server address list.

Error List

An error occurs when a network request is sent. The official Error List document is here.

Related Article

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.