gologin: github.com/dghubble/gologin/twitter Index | Files

package twitter

import "github.com/dghubble/gologin/twitter"

Package twitter provides Twitter OAuth1 login, callback, and token handlers.

Index

Package Files

context.go doc.go login.go token.go

Variables

var (
    ErrMissingToken       = fmt.Errorf("twitter: missing token field %s", accessTokenField)
    ErrMissingTokenSecret = fmt.Errorf("twitter: missing token field %s", accessTokenSecretField)
)

Errors for missing token or token secret form fields.

var (
    ErrUnableToGetTwitterUser = errors.New("twitter: unable to get Twitter User")
)

Twitter login errors

func CallbackHandler Uses

func CallbackHandler(config *oauth1.Config, success, failure http.Handler) http.Handler

CallbackHandler handles Twitter callback requests by parsing the oauth token and verifier and adding the Twitter access token and User to the ctx. If authentication succeeds, handling delegates to the success handler, otherwise to the failure handler.

func LoginHandler Uses

func LoginHandler(config *oauth1.Config, failure http.Handler) http.Handler

LoginHandler handles Twitter login requests by obtaining a request token and redirecting to the authorization URL.

func TokenHandler Uses

func TokenHandler(config *oauth1.Config, success, failure http.Handler) http.Handler

TokenHandler receives a Twitter access token/secret and calls Twitter verify_credentials to get the corresponding User. If successful, the access token/secret and User are added to the ctx and the success handler is called. Otherwise, the failure handler is called.

func UserFromContext Uses

func UserFromContext(ctx context.Context) (*twitter.User, error)

UserFromContext returns the Twitter User from the ctx.

func WithUser Uses

func WithUser(ctx context.Context, user *twitter.User) context.Context

WithUser returns a copy of ctx that stores the Twitter User.

Package twitter imports 8 packages (graph) and is imported by 1 packages. Updated 2017-12-14. Refresh now. Tools for package owners.