github.com/NaySoftware/fireauth

Firebase Auth Token Generator in Go


Install
go get github.com/NaySoftware/fireauth

Documentation

Fireauth


Build Status Coverage Status

A Firebase token generator written in Go

Installation

go get -u github.com/zabawaba99/fireauth

Usage

Import fireauth

import "github.com/zabawaba99/fireauth"

Create a TokenGenerator

gen := fireauth.New("foo")

Generate a token

data := fireauth.Data{"uid": "1"}
token, err := gen.CreateToken(data, nil)
if err != nil {
  log.Fatal(err)
}
println("my token: ",token)

Options

You can also create a token with options

data := fireauth.Data{"uid": "1"}
options := &fireauth.Option{
  NotBefore: 2,
  Expiration: 3,
  Admin: false,
  Debug: true,
}
token, err := gen.CreateToken(data, options)
if err != nil {
  log.Fatal(err)
}
println("my token: ",token)

Check the GoDocs or Firebase Auth Documentation for more details

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b new-feature)
  3. Commit your changes (git commit -am 'Some cool reflection')
  4. Push to the branch (git push origin new-feature)
  5. Create new Pull Request