getpocket: github.com/Shaked/getpocket/auth Index | Files

package auth

import "github.com/Shaked/getpocket/auth"

Index

Package Files

auth.go user.go

Variables

var (
    URLs = map[string]string{
        "RequestUrl":      "%s/v3/oauth/request",
        "RequestTokenUrl": "%s/auth/authorize?request_token=%s&redirect_uri=%s",
        "RequestAuthUrl":  "%s/v3/oauth/authorize",
    }
)

type Auth Uses

type Auth struct {
    Authenticator
    DeviceControllable
    // contains filtered or unexported fields
}

func Factory Uses

func Factory(consumerKey, redirectURI string) (*Auth, *utils.RequestError)

func New Uses

func New(consumerKey, redirectURI string, request utils.HttpRequest) (*Auth, *utils.RequestError)

Creates new getpocket auth instance consumerKey is available at http://getpocket.com/developers, redirectURI must include full URL

func (*Auth) Connect Uses

func (a *Auth) Connect() (string, *utils.RequestError)

Connect to GP API using the consumerKey

func (*Auth) RequestPermissions Uses

func (a *Auth) RequestPermissions(requestToken string, w http.ResponseWriter, r *http.Request)

Request GP API for permissions

func (*Auth) SetForceMobile Uses

func (a *Auth) SetForceMobile(forceMobile bool)

@see http://getpocket.com/developer/docs/authentication

func (*Auth) User Uses

func (a *Auth) User(requestToken string) (*PocketUser, *utils.RequestError)

Make final authentication and retrieve user details (username, access_token)

type Authenticated Uses

type Authenticated interface {
    AccessToken() string
}

type Authenticator Uses

type Authenticator interface {
    RequestPermissions(requestToken string, w http.ResponseWriter, r *http.Request)
    Connect() (string, *utils.RequestError)
    User(requestToken string) (*PocketUser, *utils.RequestError)
}

Authentication methods to connect and use GetPocket API

type DeviceControllable Uses

type DeviceControllable interface {
    SetForceMobile(forceMobile bool)
}

Optional device settings when using GetPocket API

type PocketUser Uses

type PocketUser struct {
    PAccessToken string `json:"access_token"`
    PUsername    string `json:"username"`
}

func NewUser Uses

func NewUser() *PocketUser

func (*PocketUser) AccessToken Uses

func (u *PocketUser) AccessToken() string

func (*PocketUser) SetAccessToken Uses

func (u *PocketUser) SetAccessToken(accessToken string) *PocketUser

func (*PocketUser) SetUsername Uses

func (u *PocketUser) SetUsername(username string) *PocketUser

func (*PocketUser) Username Uses

func (u *PocketUser) Username() string

type User Uses

type User interface {
    Username() string
}

Package auth imports 6 packages (graph) and is imported by 1 packages. Updated 2016-07-16. Refresh now. Tools for package owners.