auth

package
v0.0.0-...-550bc53 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

Auth is the client struct hosting helper methods for interacting with the Auth0 API specifically for token management and metadata updates.

func New

func New(cfg *config.Config) *Auth

New generates a pointer instance of the Auth client.

func (*Auth) GetManagementAPIToken

func (a *Auth) GetManagementAPIToken() (string, error)

GetManagementAPIToken fetches a token for the Auth0 Management API.

func (*Auth) GetUserToken

func (a *Auth) GetUserToken(user string) (string, error)

GetUserToken fetches a user access token for the given user stored in the config.json file.

Auth0 docs reference: https://auth0.com/docs/api/authentication?shell#resource-owner-password

func (*Auth) UpdateUserToken

func (a *Auth) UpdateUserToken(user, orgID, managementToken string) error

UpdateUserToken sets the "orgID" field on the user app_metadata.

Auth0 docs reference: https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id

type ErrorClientDo

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

ErrorClientDo wraps errors returned by http.Client.Do in the Auth struct methods.

func (ErrorClientDo) Error

func (e ErrorClientDo) Error() string

type ErrorNewRequest

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

ErrorNewRequest wraps errors returned by http.NewRequest in the Auth struct methods.

func (ErrorNewRequest) Error

func (e ErrorNewRequest) Error() string

type ErrorNon200Status

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

ErrorNon200Status wraps an error returned when a non-200 status is received in the UpdateUserToken method.

func (ErrorNon200Status) Error

func (e ErrorNon200Status) Error() string

type ErrorReadResponseBody

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

ErrorReadResponseBody wraps errors returned by ioutil.ReadAll in the Auth struct methods.

func (ErrorReadResponseBody) Error

func (e ErrorReadResponseBody) Error() string

type ErrorStatusUnauthorized

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

ErrorStatusUnauthorized wraps an error returned when a 401 status is received in the UpdateUserToken method.

func (ErrorStatusUnauthorized) Error

func (e ErrorStatusUnauthorized) Error() string

Jump to

Keyboard shortcuts

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