firebase

package
v0.11.1 Latest Latest
Warning

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

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

Documentation

Overview

Package firebase is common logic and handling around firebase.

Package firebase is common logic and handling around firebase.

Package firebase is common logic and handling around firebase.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmailNotFound    = &ErrorDetails{Err: "EMAIL_NOT_FOUND"}
	ErrInvalidOOBCode   = &ErrorDetails{Err: "INVALID_OOB_CODE"}
	ErrExpiredOOBCode   = &ErrorDetails{Err: "EXPIRED_OOB_CODE"}
	ErrCredentialTooOld = &ErrorDetails{Err: "CREDENTIAL_TOO_OLD_LOGIN_AGAIN"}
	ErrTokenExpired     = &ErrorDetails{Err: "TOKEN_EXPIRED"}
	ErrInvalidToken     = &ErrorDetails{Err: "INVALID_ID_TOKEN"}
	ErrTooManyAttempts  = &ErrorDetails{Err: "TOO_MANY_ATTEMPTS_TRY_LATER"}
)

Functions

This section is empty.

Types

type Client

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

func New

func New(ctx context.Context) (*Client, error)

func (*Client) ChangePasswordWithCode

func (c *Client) ChangePasswordWithCode(ctx context.Context, code, newPassword string) (string, error)

ChangePasswordWithCode is called with the one-time-code given from a reset email to the user. When called with newPassword, it updates the user's password.

See: https://firebase.google.com/docs/reference/rest/auth#section-send-password-reset-email

func (*Client) SendPasswordResetEmail

func (c *Client) SendPasswordResetEmail(ctx context.Context, email string) error

SendPasswordResetEmail sends a password reset email to the user.

See: https://firebase.google.com/docs/reference/rest/auth#section-send-password-reset-email

func (*Client) VerifyPasswordResetCode

func (c *Client) VerifyPasswordResetCode(ctx context.Context, code string) (string, error)

VerifyPasswordResetCode is called with the one-time-code given from a reset email to the user. It can be used to check that the code is valid without making changes to the user.

See: https://firebase.google.com/docs/reference/rest/auth#section-send-password-reset-email

type ErrorDetails

type ErrorDetails struct {
	ErrorCode int    `json:"code"`
	Err       string `json:"message"`
}

ErrorDetails is the structure firebase gives back.

func (*ErrorDetails) Error

func (err *ErrorDetails) Error() string

func (*ErrorDetails) Is

func (err *ErrorDetails) Is(target error) bool

func (*ErrorDetails) ShouldReauthenticate

func (err *ErrorDetails) ShouldReauthenticate() bool

ShouldReauthenticate returns true for errors that require a refreshed auth token.

Jump to

Keyboard shortcuts

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