Documentation
¶
Overview ¶
Package admin is the unofficial firebase admin sdk: https://firebase.google.com/docs/auth/admin/
Index ¶
- Variables
- type App
- type AppOptions
- type Auth
- func (auth *Auth) CreateCustomToken(userID string, claims interface{}) (string, error)
- func (auth *Auth) CreateUser(user *User) (*UserRecord, error)
- func (auth *Auth) DeleteUser(userID string) error
- func (auth *Auth) GetUser(uid string) (*UserRecord, error)
- func (auth *Auth) GetUserByEmail(email string) (*UserRecord, error)
- func (auth *Auth) GetUsers(userIDs []string) ([]*UserRecord, error)
- func (auth *Auth) GetUsersByEmail(emails []string) ([]*UserRecord, error)
- func (auth *Auth) ListUsers(maxResults int64) *ListAccountCursor
- func (auth *Auth) UpdateUser(user *User) (*UserRecord, error)
- func (auth *Auth) VerifyIDToken(idToken string) (*Claims, error)
- type CancelFunc
- type ChildSnapshot
- type Claims
- type DataSnapshot
- type Database
- type ErrTokenInvalid
- type ListAccountCursor
- type OldChildSnapshot
- type Query
- type Reference
- type UpdateAccount
- type User
- type UserInfo
- type UserMetadata
- type UserRecord
Constants ¶
This section is empty.
Variables ¶
var ( ErrRequireServiceAccount = errors.New("firebase: requires service account") ErrRequireUID = errors.New("firebaseauth: require user id") )
Error constants
var (
ServerValueTimestamp interface{} = map[string]string{".sv": "timestamp"}
)
ServerValue
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App holds information about application configuration
func InitializeApp ¶
func InitializeApp(options AppOptions) (*App, error)
InitializeApp initializes firebase application with options
type AppOptions ¶
AppOptions is the firebase app options for initialize app
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth type
func (*Auth) CreateCustomToken ¶
CreateCustomToken creates a custom token used for client to authenticate with firebase server using signInWithCustomToken https://firebase.google.com/docs/auth/admin/create-custom-tokens
func (*Auth) CreateUser ¶
func (auth *Auth) CreateUser(user *User) (*UserRecord, error)
CreateUser creates an user if not provides UserID, firebase server will auto generate
func (*Auth) DeleteUser ¶
DeleteUser deletes an user by user id
func (*Auth) GetUser ¶
func (auth *Auth) GetUser(uid string) (*UserRecord, error)
GetUser retrieves an user by user id
func (*Auth) GetUserByEmail ¶
func (auth *Auth) GetUserByEmail(email string) (*UserRecord, error)
GetUserByEmail retrieves user by email
func (*Auth) GetUsers ¶
func (auth *Auth) GetUsers(userIDs []string) ([]*UserRecord, error)
GetUsers retrieves users by user ids
func (*Auth) GetUsersByEmail ¶
func (auth *Auth) GetUsersByEmail(emails []string) ([]*UserRecord, error)
GetUsersByEmail retrieves users by emails
func (*Auth) ListUsers ¶
func (auth *Auth) ListUsers(maxResults int64) *ListAccountCursor
ListUser creates list account cursor for retrieves accounts MaxResults can change later after create cursor
func (*Auth) UpdateUser ¶
func (auth *Auth) UpdateUser(user *User) (*UserRecord, error)
UpdateUser updates an existing user
type Claims ¶
type Claims struct {
Issuer string `json:"iss,omitempty"`
Subject string `json:"sub,omitempty"`
Audience string `json:"aud,omitempty"`
IssuedAt int64 `json:"iat,omitempty"`
ExpiresAt int64 `json:"exp,omitempty"`
UserID string `json:"uid,omitempty"`
Claims interface{} `json:"claims,omitempty"`
}
Claims is the firebase authentication token claims
type ErrTokenInvalid ¶
type ErrTokenInvalid struct {
// contains filtered or unexported fields
}
ErrTokenInvalid is the invalid token error
func (*ErrTokenInvalid) Error ¶
func (err *ErrTokenInvalid) Error() string
Error implements error interface
type ListAccountCursor ¶
type ListAccountCursor struct {
MaxResults int64
// contains filtered or unexported fields
}
ListAccountCursor type
func (*ListAccountCursor) Next ¶
func (cursor *ListAccountCursor) Next() ([]*UserRecord, error)
Next retrieves next users from cursor which limit to MaxResults then move cursor to the next users
type Query ¶
type Query interface {
Ref() *Reference
EndAt(value interface{}, key string) Query
EqualTo(value interface{}, key string) Query
IsEqual(other interface{}) Query
LimitToFirst(limit int) Query
LimitToLast(limit int) Query
OrderByChild(path string) Query
OrderByKey() Query
OrderByPriority() Query
OrderByValue() Query
StartAt(value interface{}, key string) Query
OnValue(event chan *DataSnapshot) CancelFunc
OnChildAdded(event chan *ChildSnapshot) CancelFunc
OnChildRemoved(event chan *OldChildSnapshot) CancelFunc
OnChildChanged(event chan *ChildSnapshot) CancelFunc
OnChildMoved(event chan *ChildSnapshot) CancelFunc
OnceValue() *DataSnapshot
OnceChildAdded() *ChildSnapshot
OnceChildRemove() *OldChildSnapshot
OnceChildChanged() *ChildSnapshot
OnceChildMoved() *ChildSnapshot
String() string
}
Query is the query interface
type Reference ¶
type Reference struct {
// contains filtered or unexported fields
}
Reference represents a specific location in Database
type UpdateAccount ¶
type UpdateAccount struct {
// UserID is the existing user id to update
UserID string `json:"localId,omitempty"`
Email string `json:"email,omitempty"`
EmailVerified bool `json:"emailVerified,omitempty"`
Password string `json:"password,omitempty"`
DisplayName string `json:"displayName,omitempty"`
PhotoURL string `json:"photoUrl,omitempty"`
Disabled bool `json:"disableUser,omitempty"`
}
UpdateAccount use for update existing account
type User ¶
type User struct {
UserID string
Email string
EmailVerified bool
Password string
DisplayName string
PhotoURL string
Disabled bool
}
User use for create new user use Password when create user (plain text) use RawPassword when update user (hashed password)
type UserInfo ¶
type UserInfo struct {
UserID string
Email string
DisplayName string
PhotoURL string
ProviderID string
}
UserInfo is the user provider information
type UserRecord ¶
type UserRecord struct {
UserID string
Email string
EmailVerified bool
DisplayName string
PhotoURL string
Disabled bool
Metadata UserMetadata
ProviderData []*UserInfo
}
UserRecord is the firebase authentication user