项目作者: LewisWatson

项目描述 :
Verify firebase JWT auth tokens
高级语言: Go
项目地址: git://github.com/LewisWatson/firebase-jwt-auth.git
创建时间: 2017-02-18T10:03:22Z
项目社区:https://github.com/LewisWatson/firebase-jwt-auth

开源协议:Apache License 2.0

下载


Firebase Authentication JWT Verifier

Build Status
Coverage Status
GoDoc
stability-stable
Sourcegraph

This library follows the instructions described in verify id tokens using third-party JWT library section of the firebase documentation.

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
}