firebase

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 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)

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 sends a password reset email to the user. If the new password is given, it applies the password reset change with the new password using the code.

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