C# 클래스 Senparc.Weixin.Open.OAuth.OAuthApi

代公众号发起网页授权
파일 보기 프로젝트 열기: Chinaccn/surfboard

공개 메소드들

메소드 설명
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(如果需要)

메소드 상세

GetAccessToken() 공개 정적인 메소드

获取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
리턴 OAuthAccessTokenResult

GetAuthorizeUrl() 공개 정적인 메소드

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

GetUserInfo() 공개 정적인 메소드

获取用户基本信息
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 英语
리턴 Senparc.Weixin.Open.OAuth.OAuthUserInfo

RefreshToken() 공개 정적인 메소드

刷新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
리턴 OAuthAccessTokenResult