auth0

package
v0.0.0-...-f2b87e9 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth0Client

type Auth0Client struct {
	AppContext *utils.AppContext
}

Auth0Client manages communication with the Auth0 Management API.

func NewAuth0Client

func NewAuth0Client(appCtx *utils.AppContext) *Auth0Client

func (*Auth0Client) GetUserMetadata

func (c *Auth0Client) GetUserMetadata(accessToken string, userID string) (Auth0UserMetadata, error)

func (*Auth0Client) RequestToken

func (c *Auth0Client) RequestToken() (utils.TokenResponse, error)

Requests a new Auth0 Management API access token

func (*Auth0Client) UpdateUserMetadata

func (c *Auth0Client) UpdateUserMetadata(accessToken, userID string, metadata map[string]interface{}) error

Make a partial update of a user's metadata

type Auth0Service

type Auth0Service struct {
	Auth0Client *Auth0Client
	AppContext  *utils.AppContext
}

func NewAuth0Service

func NewAuth0Service(auth0Client *Auth0Client, appCtx *utils.AppContext) *Auth0Service

func (*Auth0Service) GetUserMetadata

func (s *Auth0Service) GetUserMetadata(userID string) (Auth0UserMetadata, error)

Wrapper service function for GetUserMetadata client function that extracts and stores Google access token from response

func (*Auth0Service) UpdateUserMetadata

func (s *Auth0Service) UpdateUserMetadata(userID string, updates map[string]interface{}) error

Wrapper service function for UpdateUserMetadata client function

type Auth0UserMetadata

type Auth0UserMetadata struct {
	CreatedAt     time.Time  `json:"created_at"`
	Email         string     `json:"email"`
	EmailVerified bool       `json:"email_verified"`
	Identities    []Identity `json:"identities"`
	Name          string     `json:"name"`
	Nickname      string     `json:"nickname"`
	Picture       string     `json:"picture"`
	UpdatedAt     time.Time  `json:"updated_at"`
	UserID        string     `json:"user_id"`
	AppMetadata   struct {
		AuthenticatedWithSpotify bool `json:"authenticated_with_spotify"`
		AuthenticatedWithGoogle  bool `json:"authenticated_with_google"`
	} `json:"app_metadata"`
	LastIP      string    `json:"last_ip"`
	LastLogin   time.Time `json:"last_login"`
	LoginsCount int       `json:"logins_count"`
}

type Identity

type Identity struct {
	Connection   string `json:"connection"`
	Provider     string `json:"provider"`
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int    `json:"expires_in"`
	UserID       string `json:"user_id"`
	IsSocial     bool   `json:"isSocial"`
}

Jump to

Keyboard shortcuts

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