public class SnsAPI extends BaseAPI
| 构造器和说明 |
|---|
SnsAPI() |
| 限定符和类型 | 方法和说明 |
|---|---|
static BaseResult |
auth(String access_token,
String openid)
检验授权凭证(access_token)是否有效
|
static weixin.popular.bean.sns.Jscode2sessionResult |
componentJscode2session(String appid,
String js_code,
String component_appid,
String component_access_token)
code 换取 session_key(微信小程序 第三方平台)
|
static String |
connectOauth2Authorize(String appid,
String redirect_uri,
boolean snsapi_userinfo,
String state)
生成网页授权 URL
|
static String |
connectOauth2Authorize(String appid,
String redirect_uri,
boolean snsapi_userinfo,
String state,
String component_appid)
生成网页授权 URL (第三方平台开发)
|
static String |
connectQrconnect(String appid,
String redirect_uri,
String state)
生成网页授权 URL (网站应用微信登录)
2.5.3
|
static weixin.popular.bean.sns.Jscode2sessionResult |
jscode2session(String appid,
String secret,
String js_code)
code 换取 session_key(微信小程序)
|
static weixin.popular.bean.sns.SnsToken |
oauth2AccessToken(String appid,
String secret,
String code)
通过code换取网页授权access_token
|
static weixin.popular.bean.sns.SnsToken |
oauth2ComponentAccessToken(String appid,
String code,
String component_appid,
String component_access_token)
通过code换取网页授权access_token (第三方平台开发)
|
static weixin.popular.bean.sns.SnsToken |
oauth2ComponentRefreshToken(String appid,
String refresh_token,
String component_appid,
String component_access_token)
刷新access_token (第三方平台开发)
|
static weixin.popular.bean.sns.SnsToken |
oauth2RefreshToken(String appid,
String refresh_token)
刷新access_token
|
static weixin.popular.bean.user.User |
userinfo(String access_token,
String openid,
String lang)
拉取用户信息(需scope为 snsapi_userinfo)
|
static weixin.popular.bean.user.User |
userinfo(String access_token,
String openid,
String lang,
int emoji)
拉取用户信息(需scope为 snsapi_userinfo)
|
public static weixin.popular.bean.sns.SnsToken oauth2AccessToken(String appid, String secret, String code)
appid - appidsecret - secretcode - codepublic static weixin.popular.bean.sns.SnsToken oauth2ComponentAccessToken(String appid, String code, String component_appid, String component_access_token)
appid - appidcode - codecomponent_appid - 服务开发方的appidcomponent_access_token - 服务开发方的access_tokenpublic static weixin.popular.bean.sns.SnsToken oauth2RefreshToken(String appid, String refresh_token)
appid - appidrefresh_token - refresh_tokenpublic static weixin.popular.bean.sns.SnsToken oauth2ComponentRefreshToken(String appid, String refresh_token, String component_appid, String component_access_token)
appid - appidrefresh_token - refresh_tokencomponent_appid - 服务开发商的appidcomponent_access_token - 服务开发方的access_tokenpublic static BaseResult auth(String access_token, String openid)
access_token - access_tokenopenid - openidpublic static weixin.popular.bean.user.User userinfo(String access_token, String openid, String lang, int emoji)
access_token - access_tokenopenid - openidlang - 国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语emoji - 表情解析方式public static weixin.popular.bean.user.User userinfo(String access_token, String openid, String lang)
access_token - access_tokenopenid - openidlang - 国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语public static String connectOauth2Authorize(String appid, String redirect_uri, boolean snsapi_userinfo, String state)
appid - appidredirect_uri - 自动URLEncodersnsapi_userinfo - snsapi_userinfostate - 可以为空public static String connectOauth2Authorize(String appid, String redirect_uri, boolean snsapi_userinfo, String state, String component_appid)
appid - appidredirect_uri - 自动URLEncodersnsapi_userinfo - snsapi_userinfostate - 可以为空component_appid - 第三方平台开发,可以为空。
服务方的appid,在申请创建公众号服务成功后,可在公众号服务详情页找到public static String connectQrconnect(String appid, String redirect_uri, String state)
appid - appidredirect_uri - 自动URLEncoderstate - 可以为空public static weixin.popular.bean.sns.Jscode2sessionResult jscode2session(String appid, String secret, String js_code)
appid - appidsecret - secretjs_code - js_codepublic static weixin.popular.bean.sns.Jscode2sessionResult componentJscode2session(String appid, String js_code, String component_appid, String component_access_token)
appid - appidjs_code - js_codecomponent_appid - component_appidcomponent_access_token - component_access_tokenCopyright © 2017. All rights reserved.