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

代公众号发起网页授权
Exibir arquivo Open project: JeffreySu/WeiXinMPSDK

Public Methods

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

获取AccessToken

GetAccessTokenAsync ( string appId, string componentAppid, string componentAccessToken, string code, string grantType = "authorization_code" ) : Task

【异步方法】获取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 ) : OAuthUserInfo

获取用户基本信息

GetUserInfoAsync ( string accessToken, string openId, Language lang = Language.zh_CN ) : Task

【异步方法】获取用户基本信息

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

刷新access_token(如果需要)

RefreshTokenAsync ( string appId, string refreshToken, string componentAppid, string componentAccessToken, string grantType = "refresh_token" ) : Task

【异步方法】刷新access_token(如果需要)

Method Details

GetAccessToken() public static method

获取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
return OAuthAccessTokenResult

GetAccessTokenAsync() public static method

【异步方法】获取AccessToken
public static GetAccessTokenAsync ( string appId, string componentAppid, string componentAccessToken, string code, string grantType = "authorization_code" ) : Task
appId string
componentAppid string 服务开发方的appid
componentAccessToken string 服务开发方的access_token
code string GetAuthorizeUrl()接口返回的code
grantType string
return Task

GetAuthorizeUrl() public static method

获取验证地址
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
return string

GetUserInfo() public static method

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

GetUserInfoAsync() public static method

【异步方法】获取用户基本信息
public static GetUserInfoAsync ( string accessToken, string openId, Language lang = Language.zh_CN ) : Task
accessToken string 调用接口凭证
openId string 普通用户的标识,对当前公众号唯一
lang Language 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
return Task

RefreshToken() public static method

刷新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
return OAuthAccessTokenResult

RefreshTokenAsync() public static method

【异步方法】刷新access_token(如果需要)
public static RefreshTokenAsync ( string appId, string refreshToken, string componentAppid, string componentAccessToken, string grantType = "refresh_token" ) : Task
appId string
refreshToken string 填写通过access_token获取到的refresh_token参数
componentAppid string
componentAccessToken string
grantType string
return Task