oauth2

package
v0.0.0-...-2eb796a Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownPlatform = errors.New("unknown platform")
View Source
var ErrUnknownService = errors.New("unknown service")

Functions

func OauthConfig

func OauthConfig(providers config.OauthConfig, service Service, platform Platform) (*oauth2.Config, error)

Types

type Platform

type Platform string
const (
	Web     Platform = "web"
	Android Platform = "android"
	IOS     Platform = "ios"
)

func ParsePlatform

func ParsePlatform(s string) (Platform, error)

type Service

type Service string
const (
	Google Service = "google"
	Yandex Service = "yandex"
	VK     Service = "vk"
)

func ParseService

func ParseService(s string) (Service, error)

type User

type User struct {
	ID       string
	Username string
	Email    *string
}

func GithubOauth

func GithubOauth(providers config.OauthConfig, code string, service Service, platform Platform) (*User, error)

func GoogleOauth

func GoogleOauth(providers config.OauthConfig, code string, service Service, platform Platform) (*User, error)

func VKOauth

func VKOauth(providers config.OauthConfig, code string, service Service, platform Platform) (*User, error)

func YandexOauth

func YandexOauth(providers config.OauthConfig, code string, service Service, platform Platform) (*User, error)

Jump to

Keyboard shortcuts

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