A Firebase token generator written in Go
go get -u github.com/zabawaba99/fireauth
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)
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
- Fork it
- Create your feature branch (
git checkout -b new-feature
) - Commit your changes (
git commit -am 'Some cool reflection'
) - Push to the branch (
git push origin new-feature
) - Create new Pull Request