Documentation ¶
Index ¶
- Constants
- Variables
- func CreateCustomToken(c context.Context, uid string, developerClaims interface{}) (string, error)
- func VerifyIDToken(c context.Context, idToken string) (*jwt.Token, error)
- func WithServiceAccount(c context.Context, sa *ServiceAccount) context.Context
- type AppEngineSigningMethod
- type FirebaseClaims
- type ServiceAccount
Constants ¶
View Source
const ( // ClientCertURL is URL containing the public keys for the Google certs ClientCertURL = "https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com" // FirebaseAudienceURL is Audience to use for Firebase Auth Custom tokens FirebaseAudienceURL = "https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit" )
Variables ¶
View Source
var ( // BlackListedClaims is List of blacklisted claims which cannot be provided when creating a custom token // FYI: https://firebase.google.com/docs/auth/server/create-custom-tokens BlackListedClaims = []string{ "acr", "amr", "at_hash", "aud", "auth_time", "azp", "cnf", "c_hash", "exp", "iat", "iss", "jti", "nbf", "nonce", } )
Functions ¶
func CreateCustomToken ¶
CreateCustomToken is Creates a new Firebase Auth Custom token.
func VerifyIDToken ¶
VerifyIDToken is Verifies the format and signature of a Firebase Auth ID token
func WithServiceAccount ¶
func WithServiceAccount(c context.Context, sa *ServiceAccount) context.Context
WithServiceAccount returns copy parent context and associates it with ServiceAccount.
Types ¶
type AppEngineSigningMethod ¶
type AppEngineSigningMethod struct{}
AppEngineSigningMethod is built-in AppEngine signing method
func (*AppEngineSigningMethod) Alg ¶
func (s *AppEngineSigningMethod) Alg() string
Alg is algorithm name
func (*AppEngineSigningMethod) Sign ¶
func (s *AppEngineSigningMethod) Sign(signingString string, key interface{}) (string, error)
Sign is Implment SigningMethod#Sign
func (*AppEngineSigningMethod) Verify ¶
func (s *AppEngineSigningMethod) Verify(signingString, signature string, key interface{}) error
Verify is Implment SigningMethod#Verify
type FirebaseClaims ¶
type FirebaseClaims struct { UID string `json:"uid,omitempty"` UserIDStr string `json:"user_id,omitempty"` Email string `json:"email,omitempty"` EmailVerified bool `json:"email_verified,omitempty"` Claims interface{} `json:"claims,omitempty"` Firebase *struct { SignInProvider string `json:"sign_in_provider,omitempty"` Identities map[string][]string `json:"identities,omitempty"` } `json:"firebase,omitempty"` *jwt.StandardClaims }
FirebaseClaims is Token struct
func (*FirebaseClaims) UserID ¶
func (f *FirebaseClaims) UserID() string
UserID is Firebase UserID from Token
type ServiceAccount ¶
type ServiceAccount struct { Type string `json:"type,omitempty"` ProjectID string `json:"project_id,omitempty"` PrivateKeyID string `json:"private_key_id,omitempty"` PrivateKey string `json:"private_key,omitempty"` ClientEmail string `json:"client_email,omitempty"` ClientID string `json:"client_id,omitempty"` AuthURI string `json:"auth_uri,omitempty"` TokenURI string `json:"token_uri,omitempty"` AuthProviderX509CertURL string `json:"auth_provider_x509_cert_url,omitempty"` ClientX509CertURL string `json:"client_x509_cert_url,omitempty"` }
Click to show internal directories.
Click to hide internal directories.