# README
Firebase Authentication JWT Verifier
This library follows the instructions described in verify id tokens using third-party JWT library section of the firebase documentation.
Example Usage
import (
"github.com/LewisWatson/firebase-jwt-auth"
"github.com/manyminds/api2go"
)
// tokenVerifier previously initialised with fireauth.New("projectname")
func verify(r api2go.Request, tokenVerifier fireauth.TokenVerifier) error {
token := r.Header.Get("authorization")
userID, claims, err := tokenVerifier.Verify(token)
if err != nil {
return err
}
r.Context.Set("userID", userID)
r.Context.Set("claims", claims)
return nil
}
# Constants
FirebaseKeyURL Firebase key provider url specified in https://firebase.google.com/docs/auth/admin/verify-id-tokens#verify_id_tokens_using_a_third-party_jwt_library.
HeaderCacheControl Cache-Control field in http response header.
IssPrefix JWT issuer prefix specified in https://firebase.google.com/docs/auth/admin/verify-id-tokens#verify_id_tokens_using_a_third-party_jwt_library.
# Variables
ErrCacheControlHeaderLacksMaxAge indicates that the key server response didnt contain a max age as specified by the firebase docs.
ErrNilToken is returned when the authorization token is empty.
ErrNotIssuedYet indicates that the token hasn't been issued yet.
ErrRSAVerification is missing from crypto/ecdsa compared to crypto/rsa.
# Interfaces
TokenVerifier verifies authenticaion tokens.