auth

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsLoggedIn

func IsLoggedIn() bool

func Logout

func Logout() error

To logout the user, simply delete account config

func RefreshAndSave

func RefreshAndSave() error

Types

type Claims

type Claims struct {
	Hasura HasuraClaims `json:"https://hasura.io/jwt/claims"`
	jwt.RegisteredClaims
}

type HasuraClaims

type HasuraClaims struct {
	AllowedRoles []string `json:"x-hasura-allowed-roles,omitempty"`
	DefaultRole  string   `json:"x-hasura-default-role,omitempty"`
	UserID       string   `json:"x-hasura-user-id,omitempty"`
	UserEmail    string   `json:"x-hasura-user-email,omitempty"`
	IsAnonymous  string   `json:"x-hasura-user-is-anonymous,omitempty"`
}

type LoginResponse

type LoginResponse struct {
	MFA struct {
		Ticket string `json:"ticket"`
	} `json:"mfa"`

	Session NhostSession `json:"session"`
}

func Login

func Login(payload map[string]interface{}) (*LoginResponse, error)

func RefreshToken

func RefreshToken(payload map[string]interface{}) (*LoginResponse, error)

type NhostSession

type NhostSession struct {
	AccessToken          string           `json:"accessToken"`
	AccessTokenExpiresIn int              `json:"accessTokenExpiresIn"`
	RefreshToken         string           `json:"refreshToken"`
	User                 userCommons.User `json:"user"`
}

Jump to

Keyboard shortcuts

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