Documentation ¶
Overview ¶
百度授权相关,wiki地址 https://openauth.baidu.com/doc/doc.html
Index ¶
Constants ¶
View Source
const OAuthTokenUri = "/oauth/2.0/token"
View Source
const OAuthUri = "/oauth/2.0/authorize"
View Source
const UserInfoUri = "/rest/2.0/passport/users/getInfo"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessTokenResponse ¶
type AccessTokenResponse struct { AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` RefreshToken string `json:"refresh_token"` Scope string `json:"scope"` SessionKey string `json:"session_key"` SessionSecret string `json:"session_secret"` Error string `json:"error"` ErrorDescription string `json:"error_description"` }
type Auth ¶
func NewAuthClient ¶
func (*Auth) AccessToken ¶
func (a *Auth) AccessToken(code, redirectUri string) (AccessTokenResponse, error)
获取AccessToken
func (*Auth) RefreshToken ¶
func (a *Auth) RefreshToken(refreshToken string) (RefreshTokenResponse, error)
刷新AccessToken
type RefreshTokenResponse ¶
type RefreshTokenResponse struct { AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` RefreshToken string `json:"refresh_token"` Scope string `json:"scope"` SessionKey string `json:"session_key"` SessionSecret string `json:"session_secret"` Error string `json:"error"` ErrorDescription string `json:"error_description"` }
type UserInfoResponse ¶
type UserInfoResponse struct { OpenID string `json:"openid"` UnionID string `json:"unionid"` // 百度用户统一标识,对当前开发者帐号唯一 UserID string `json:"userid"` // 老版百度用户的唯一标识,后续不在返回该字段,user_id字段对应account.UserInfo方法返回的uk UserName string `json:"username"` SecureMobile int `json:"securemobile"` // 当前用户绑定手机号,需要向百度开放平台单独申请权限 Portrait string `json:"portrait"` UserDetail string `json:"userdetail"` Birthday string `json:"birthday"` Marriage string `json:"marriage"` Sex string `json:"sex"` Blood string `json:"blood"` IsBindMobile string `json:"is_bind_mobile"` IsRealName string `json:"is_realname"` ErrorCode int `json:"errno"` ErrorMsg string `json:"errmsg"` }
Click to show internal directories.
Click to hide internal directories.