Documentation
¶
Index ¶
- Variables
- func BeginTwitterAuth() (state string, pkceCodeVerifier string, redirect string, err error)
- func DefaultScopes() []string
- func FinishTwitterAuth(ctx context.Context, state, prevState, pkceCodeVerifier, code string) (*oauth2.Token, error)
- func OAuthConfig() *oauth2.Config
- type Client
- type GetMeResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ScopeOfflineAccess = "offline.access" ScopeTweetWrite = "tweet.write" ScopeUsersRead = "users.read" ScopeTweetRead = "tweet.read" )
View Source
var Endpoint = oauth2.Endpoint{ AuthStyle: oauth2.AuthStyleInHeader, AuthURL: "https://twitter.com/i/oauth2/authorize", TokenURL: "https://api.twitter.com/2/oauth2/token", }
Functions ¶
func BeginTwitterAuth ¶
func DefaultScopes ¶
func DefaultScopes() []string
func FinishTwitterAuth ¶
func OAuthConfig ¶
Types ¶
type GetMeResponse ¶
type GetMeResponse struct {
Data struct {
ID string `json:"id"`
Name string `json:"name"`
Username string `json:"username"`
} `json:"data"`
}
GetMeResponse is the structure of the response from https://api.twitter.com/2/users/me
{
"data": {
"id": "2244994945",
"name": "TwitterDev",
"username": "Twitter Dev"
}
}
Click to show internal directories.
Click to hide internal directories.