gocialite

package module
v0.0.0-...-f324f8a Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: MIT Imports: 13 Imported by: 0

README

Go-Soclialite

golang 社会登录包

安装

安装运行 go get github.com/bigrocs/go-socialite 代码内引入: import "github.com/bigrocs/go-socialite"

支持的驱动 drivers

  • Amazon
  • Asana
  • Bitbucket
  • Facebook
  • Foursquare
  • Github
  • Google
  • LinkedIn
  • Slack

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterNewDriver

func RegisterNewDriver(driver string, defaultscopes []string, callback func(client *http.Client, u *structs.User), endpoint oauth2.Endpoint, apimap, usermap map[string]string)

RegisterNewDriver adds a new driver to the existing set

Types

type Dispatcher

type Dispatcher struct {
	// contains filtered or unexported fields
}

Dispatcher allows to safely issue concurrent Gocials

func NewDispatcher

func NewDispatcher() *Dispatcher

NewDispatcher creates new Dispatcher

func (*Dispatcher) Handle

func (d *Dispatcher) Handle(state, code string) (*structs.User, *oauth2.Token, error)

Handle callback. Can be called only once for given state.

func (*Dispatcher) New

func (d *Dispatcher) New() *Gocial

New Gocial instance

type Gocial

type Gocial struct {
	User  structs.User
	Token *oauth2.Token
	// contains filtered or unexported fields
}

Gocial is the main struct of the package

func (*Gocial) Driver

func (g *Gocial) Driver(driver string) *Gocial

Driver is needed to choose the correct social

func (*Gocial) Handle

func (g *Gocial) Handle(state, code string) error

Handle callback from provider

func (*Gocial) Redirect

func (g *Gocial) Redirect(clientID, clientSecret, redirectURL string) (string, error)

Redirect returns an URL for the selected social oAuth login

func (*Gocial) Scopes

func (g *Gocial) Scopes(scopes []string) *Gocial

Scopes is used to set the oAuth scopes, for example "user", "calendar"

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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