weiboOAuth

package
v0.0.0-...-e9e0146 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthURL        = "https://api.weibo.com/oauth2/authorize"
	AccessTokenURL = "https://api.weibo.com/oauth2/access_token"
	UserInfoURL    = "https://api.weibo.com/2/users/show.json"
)

Variables

View Source
var Logging bool

Functions

This section is empty.

Types

type OAuth

type OAuth struct {
	ClientID     string
	ClientSecret string
	RedirectURL  string
}

func NewWeiboOAuth

func NewWeiboOAuth(clientID, clientSecret, redirectURL string) (*OAuth, error)

func (*OAuth) GetAccessToken

func (oauth *OAuth) GetAccessToken(code string) (*OAuthToken, error)

func (*OAuth) GetAuthorizationURL

func (oauth *OAuth) GetAuthorizationURL(state string) (string, error)

func (*OAuth) GetUserInfo

func (oauth *OAuth) GetUserInfo(accessToken, uid string) (*UserInfo, error)

type OAuthToken

type OAuthToken struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
	RemindIn    string `json:"remind_in"`
	UIDString   string `json:"uid"`

	Error        string `json:"error"`
	ErrorCode    int    `json:"error_code"`
	ErrorMessage string `json:"error_description"`
}

type UserInfo

type UserInfo struct {
	UID         int64  `json:"id"`
	Name        string `json:"name"`
	Location    string `json:"location"`
	Description string `json:"description"`
	Avatar      string `json:"profile_image_url"`
	URL         string `json:"url"`
	Gender      string `json:"gender"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL