Documentation ¶
Overview ¶
Package firebase provides authentication utilities for applications servers to integrate with Firebase.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the entry point of the SDK. It holds common configuration and state for Firebase APIs. Most applications don't need to directly interact with App.
func GetAppWithName ¶
GetAppWithName retrieves an instance of the App with a given name, creating it if necessary.
func InitializeApp ¶
InitializeApp initializes the default App instance.
func InitializeAppWithName ¶
InitializeAppWithName initializes an App with a unique given name.
It is an error to initialize an app with an already existing name. Starting and ending whitespace characters in the name are ignored (trimmed).
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth is the entry point for all server-side Firebase Authentication actions.
You can get an instance of Auth via GetInstance(*App) and then use it to perform a variety of authentication-related operations, including generating custom tokens for use by client-side code, verifying Firebase ID Tokens received from clients, or creating new App instances that are scoped to a particular authentication UID.
func GetAuthWithApp ¶
GetAuthWithApp gets an instance of Auth for a specific App.
func (*Auth) CreateCustomToken ¶
CreateCustomToken creates a Firebase Custom Token associated with the given UID and additionally containing the specified developerClaims. This token can then be provided back to a client application for use with the signInWithCustomToken authentication API.
The UID identifies the user to other Firebase services (Firebase Database, Storage, etc.) and should be less than 128 characters. The developer claims are optional, additional claims to be stored in the token. The claims must be serializable to JSON.
func (*Auth) VerifyIDToken ¶
VerifyIDToken parses and verifies a Firebase ID Token.
A Firebase application can identify itself to a trusted backend server by sending its Firebase ID Token (accessible via the getToken API in the Firebase Authentication client) with its request.
The backend server can then use the VerifyIDToken() method to verify the token is valid, meaning: the token is properly signed, has not expired, and it was issued for the project associated with this Auth instance (which by default is extracted from your service account).
func (*Auth) VerifyIDTokenWithTransport ¶
func (a *Auth) VerifyIDTokenWithTransport(tokenString string, transport http.RoundTripper) (*Token, error)
VerifyIDToken parses and verifies a Firebase ID Token.
Same as VerifyIDToken but with the possibility to define the Transport to be use by http.Client This have to be use in Google App Engine standard environment with the fetchUrl transport.
type Certificates ¶
type Certificates struct { // URL to retrieve the public certificates, meant to be initialized only once. URL string // Transport is the network transport, meant to be initialized only once. Transport http.RoundTripper // lock for the certs and the exp sync.RWMutex // contains filtered or unexported fields }
Certificates holds a collection of public certificates that are fetched from a given URL. The certificates can be reloaded when the cached certs are expired.
func (*Certificates) Cert ¶
func (c *Certificates) Cert(kid string) (*x509.Certificate, error)
Cert returns the public certificate for the given key ID.
type Claims ¶
type Claims map[string]interface{}
Claims to be stored in a custom token (and made available to security rules in Database, Storage, etc.). These must be serializable to JSON (e.g. contains only Maps, Arrays, Strings, Booleans, Numbers, etc.).
type GoogleServiceAccountCredential ¶
type GoogleServiceAccountCredential struct { // ProjectID is the project ID. ProjectID string // PrivateKey is the RSA256 private key. PrivateKey *rsa.PrivateKey // ClientEmail is the client email. ClientEmail string }
GoogleServiceAccountCredential is the credential for a GCP Service Account.
func (*GoogleServiceAccountCredential) UnmarshalJSON ¶
func (c *GoogleServiceAccountCredential) UnmarshalJSON(data []byte) error
UnmarshalJSON is the custom unmarshaler for GoogleServiceAccountCredential. Private key is parsed from PEM format.
type Options ¶
type Options struct { // ServiceAccountPath is the path to load the Service Account. ServiceAccountPath string // ServiceAccountCredential is the credential for the Service Account. ServiceAccountCredential *GoogleServiceAccountCredential }
Options is storage for configurable Firebase options.
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
Token is a parsed read-only ID Token struct. It can be used to get the uid and other attributes of the user provided in the token.
func (*Token) IsEmailVerified ¶
IsEmailVerified indicates if the email address returned by Email() has been verified as good.