Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lewiswatson/firebase-jwt-auth
Verify firebase JWT auth tokens
https://github.com/lewiswatson/firebase-jwt-auth
firebase firebase-auth jwt-token
Last synced: 27 days ago
JSON representation
Verify firebase JWT auth tokens
- Host: GitHub
- URL: https://github.com/lewiswatson/firebase-jwt-auth
- Owner: LewisWatson
- License: apache-2.0
- Created: 2017-02-18T10:03:22.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-01T22:17:57.000Z (almost 8 years ago)
- Last Synced: 2024-12-15T23:37:46.904Z (30 days ago)
- Topics: firebase, firebase-auth, jwt-token
- Language: Go
- Size: 63.5 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Firebase Authentication JWT Verifier
[![Build Status](https://travis-ci.org/LewisWatson/firebase-jwt-auth.svg?branch=master)](https://travis-ci.org/LewisWatson/firebase-jwt-auth)
[![Coverage Status](https://coveralls.io/repos/github/LewisWatson/firebase-jwt-auth/badge.svg?branch=master)](https://coveralls.io/github/LewisWatson/firebase-jwt-auth?branch=master)
[![GoDoc](https://godoc.org/github.com/SermoDigital/jose?status.svg)](https://godoc.org/github.com/LewisWatson/firebase-jwt-auth)
[![stability-stable](https://img.shields.io/badge/stability-stable-green.svg)](https://github.com/emersion/stability-badges#stable)
[![Sourcegraph](https://sourcegraph.com/github.com/LewisWatson/firebase-jwt-auth/-/badge.svg)](https://sourcegraph.com/github.com/LewisWatson/firebase-jwt-auth?badge)This library follows the instructions described in [verify id tokens using third-party JWT library](https://firebase.google.com/docs/auth/admin/verify-id-tokens#verify_id_tokens_using_a_third-party_jwt_library) section of the firebase documentation.
[Firebase]: https://firebase.google.com/ "Firebase"
[JWT]: https://jwt.io/ "JWT"## Example Usage
```go
import (
"gopkg.in/LewisWatson/firebase-jwt-auth.v1"
"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
}