oauth

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package oauth is a wrapper around x/oauth2 to provide oauth2 authetication for various providers

Index

Constants

View Source
const (
	ProviderGoogle   = "google"
	ProviderFacebook = "facebook"
)

Variables

This section is empty.

Functions

func AddConstProvider

func AddConstProvider(funcs map[string]interface{}) map[string]interface{}

func Authenticate

func Authenticate(returnTo string, errorHandler func(http.ResponseWriter, *http.Request, error)) func(http.Handler) http.Handler

func IsValidProvider

func IsValidProvider(provider string) bool

func Redirect

func Redirect(returnTo string, errorHandler func(http.ResponseWriter, *http.Request, error)) http.HandlerFunc

Types

type State

type State struct {
	Csrftoken string
	Provider  string
}

type User

type User struct {
	ID            string `json:"id"`
	Email         string `json:"email"`
	VerifiedEmail bool   `json:"verified_email"`
	Name          string `json:"name"`
	GivenName     string `json:"given_name"`
	FamilyName    string `json:"family_name"`
	Link          string `json:"link"`
	Picture       string `json:"picture"`
	Gender        string `json:"gender"`
	Locale        string `json:"locale"`
}

Jump to

Keyboard shortcuts

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