Joke Collection Website - Blessing messages - Wechat official account to obtain user information.
Wechat official account to obtain user information.
One is to obtain user information through webpage authorization. One is to obtain the basic information of the user according to the user OpenID after the message interaction between the user and the official WeChat account or after the event after attention is pushed.
Please pay special attention to two points:
The first point is that they have different addresses when requesting user information from WeChat.
Interface address of "Access to User Basic Information Interface" for webpage authorization request:
/sns/userinfo? Access token = access token & OpenID = OpenID & lang = zh _ cn
Address of "Access User Basic Information Interface" in user management interface:
/cgi-bin/user/info? Access token = access token & OpenID = OpenID & lang = zh _ cn
The second point is that the webpage authorization access_token used by "webpage authorization" to obtain user information is different from ordinary access_token, which can be understood as an access_token between users, service numbers and WeChat. Access_token used in "Interface for Obtaining User Basic Information" in user management interface is the only interface calling voucher for official WeChat account, and it is necessary for official WeChat account to use access_token when calling all interfaces.
The first type: Web pages authorize access to user information.
Wechat document address: Web page authorization
Explain the difference between the authorization scope of two web pages.
The webpage authorization initiated by 1.snsapi_base is used to obtain the openid of the user who enters the page, and it is silent authorization and automatically jumps to the callback page. What users perceive is that they go directly to the callback page (usually the business page).
2. The webpage authorized by 2.snsapi_userinfo is used to obtain the basic information of users. However, this authorization requires the user's manual consent, and because the user has already agreed, you can get the basic information of the user after authorization without paying attention.
The webpage authorization process is divided into four steps:
1. Guide the user to enter the authorization page to agree to authorization and get the code.
2. Web page authorizes the exchange code of access_token (different from access_token in basic support).
3. If necessary, the developer can refresh the webpage authorization access_token to avoid expiration.
4. access_token and openid are authorized through the webpage to obtain the basic information of users.
Web page authorization request WeChat address: /sns/userinfo? Access token = access token & OpenID = OpenID & lang = zh _ cn
Requested parameters:
We can obtain the following user information through webpage authorization:
The second way to get user information is to call the "Get User Basic Information Interface" in the user management interface.
Document address: user management to obtain user information
Request parameters:
User information obtained:
- Previous article:Latest Gree air conditioner price inquiry
- Next article:How much is a mobile phone SIM card?
- Related articles
- What are the VIP cards of China Merchants Bank, Club and Club?
- Many confirmed cases and asymptomatic infections have been reported in Hainan province, and Hubei province has provided urgent tips for disease control.
- Teacher’s Day blessing messages from parents
- Spring Festival greetings from barber shop
- Ding-dong, how to buy food, black rider?
- How can my husband write an invitation letter and send a circle of friends when he is 36 years old?
- OppoA 100 How to export SMS to the computer? Detailed solutions, Baidu's other people's answers are not detailed enough.
- Suddenly can't send and receive text messages
- New Year's Eve Copywriting New Year's Eve Blessings Sentences Copywriting Materials
- How to download mobile software to scan ID card for nucleic acid analysis