C# Class Senparc.Weixin.Open.OAuth.OAuthApi

代公众号发起网页授权
Afficher le fichier Open project: Chinaccn/surfboard

Méthodes publiques

Méthode Description
GetAccessToken ( string appId, string componentAppid, string componentAccessToken, string code, string grantType = "authorization_code" ) : OAuthAccessTokenResult

获取AccessToken

GetAuthorizeUrl ( string appId, string componentAppId, string redirectUrl, string state, OAuthScope scopes, string responseType = "code" ) : string

获取验证地址

GetUserInfo ( string accessToken, string openId, Language lang = Language.zh_CN ) : Senparc.Weixin.Open.OAuth.OAuthUserInfo

获取用户基本信息

RefreshToken ( string appId, string refreshToken, string componentAppid, string componentAccessToken, string grantType = "refresh_token" ) : OAuthAccessTokenResult

刷新access_token(如果需要)

Method Details

GetAccessToken() public static méthode

获取AccessToken
public static GetAccessToken ( string appId, string componentAppid, string componentAccessToken, string code, string grantType = "authorization_code" ) : OAuthAccessTokenResult
appId string
componentAppid string 服务开发方的appid
componentAccessToken string 服务开发方的access_token
code string GetAuthorizeUrl()接口返回的code
grantType string
Résultat OAuthAccessTokenResult

GetAuthorizeUrl() public static méthode

获取验证地址
public static GetAuthorizeUrl ( string appId, string componentAppId, string redirectUrl, string state, OAuthScope scopes, string responseType = "code" ) : string
appId string 公众号的appid
componentAppId string 第三方平台的appid
redirectUrl string 重定向地址,需要urlencode,这里填写的应是服务开发方的回调地址
state string 重定向后会带上state参数,开发者可以填写任意参数值,最多128字节
scopes OAuthScope
responseType string 默认,填code
Résultat string

GetUserInfo() public static méthode

获取用户基本信息
public static GetUserInfo ( string accessToken, string openId, Language lang = Language.zh_CN ) : Senparc.Weixin.Open.OAuth.OAuthUserInfo
accessToken string 调用接口凭证
openId string 普通用户的标识,对当前公众号唯一
lang Language 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
Résultat Senparc.Weixin.Open.OAuth.OAuthUserInfo

RefreshToken() public static méthode

刷新access_token(如果需要)
public static RefreshToken ( string appId, string refreshToken, string componentAppid, string componentAccessToken, string grantType = "refresh_token" ) : OAuthAccessTokenResult
appId string
refreshToken string 填写通过access_token获取到的refresh_token参数
componentAppid string
componentAccessToken string
grantType string
Résultat OAuthAccessTokenResult