Project

firejwt

0.0
Low commit activity in last 3 years
No release in over a year
Firebase JWT validation
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
 Project Readme

FireJWT

Test License

Decode and validate Google Firebase JWT tokens with Ruby and Go.

Usage

Ruby:

require 'firejwt'

# Init a validator
validator = FireJWT::Validator.new 'my-project'

# Decode a token
token = begin
  validator.decode('eyJh...YbQ') # => {'sub' => 'me@example.com', 'aud' => 'my-project'}
rescue JWT::DecodeError
  nil
end

Go:

package main

import (
  "log"

  "github.com/bsm/firejwt"
)

func main() {
  vr, err := firejwt.New("my-project")
  if err != nil {
    log.Fatalln(err)
  }
  defer vr.Stop()

  tk, err := vr.Decode("eyJh...YbQ")
  if err != nil {
    log.Fatalln(err)
  }

  log.Println(tk.Claims) // => {"sub": "me@example.com", "aud": "my-project"}
}