# Refresh user authorization credentials
Interface should be called on the server side, not in the front end (Weixin Mini Program, web pages, APP, etc.) directly called, specific reference interface call guide
Interface English name: snsRefreshToken
Because access_token has a short expiration date, when the access_token is overdue, it can be refreshed using the refresh_token, which is valid for 30 days, and when the refresh-token expires, the user is required to reauthorize.
Note: The frequency limit for this interface is 50,000 / min
# 1. How to call
# HTTPS calls
GET https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=APPID&grant_type=GRANT_TYPE&refresh_token=REFRESH_TOKEN
# Cloud Calls
- This interface does not support cloud calls
# Third party invocation
- Third Party Platform calls are not supported by this interface.
# 2. Request parameters
# Query parametersQuery String parameters
Parameter Name | type | Required to fill in | Example | Introductions |
---|---|---|---|---|
appid | string | yes | - | Unique identifier for Official Account |
grant_type | string | yes | refresh_token | Fill in refresh_token |
refresh_token | string | yes | - | Fill in the refresh_token parameter obtained by access_token |
# Request BodyRequest Payload
nothing
# 3. Return Parameters
# Response Payload
Parameter Name | type | Introductions |
---|---|---|
access_token | string | Web page authorization interface invocation credentials. Note: This access_token is different from the underlying supported access_token |
expires_in | number | access_token Interface Call Credential Timeout, in seconds |
refresh_token | string | User refresh access_token |
openid | string | User unique identifier |
scope | string | User authorized domains, separated by comma (,) |
# 4. Note
There are no special considerations for this interface
# 5. Code examples
Example Requests
https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=APPID&grant_type=refresh_token&refresh_token=REFRESH_TOKEN
Return an example
{
"access_token":"ACCESS_TOKEN",
"expires_in":7200,
"refresh_token":"REFRESH_TOKEN",
"openid":"OPENID",
"scope":"SCOPE"
}
# 6. Error code
The following is a list of error codes for this interface, other error codes can refer to General error codes
Error code | Error Description | Solutions |
---|---|---|
40029 | Invalid code | Js_code is invalid |
# 7. Scope of application
How this interface can be invoked under different account types:
Service Account | Mobile App | Website App |
---|---|---|
Certification only | ✔ | ✔ |
- Authentication only: means that only authenticated accounts are allowed to be invoked by the enterprise entity, and accounts that are not authenticated or do not support authentication cannot be invoked.
- ✔: The account can call this interface
- Other account types that are not expressly stated may not be called on this interface without special instructions;