firebase

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 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.

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) SendEmailVerification added in v0.15.0

func (c *Client) SendEmailVerification(ctx context.Context, idToken string) error

SendEmailVerification sends a message to verify the email address.

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

func (*Client) SendNewUserInvitation added in v0.12.0

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

SendNewUserInvitation sends a password reset email to the user.

TODO(whaught): we're heading towards deprecating this in favor of directly sending our own email this currently sends password-reset and needs to be sending an invitation, but also may face rate-limiting on the firebase side if called too quickly.

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