Skip to content

tianhai82/gae_authen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang simple authentication module for Google App Engine

Installation

go get github.com/tianhai82/gae_authen

Note! Usage guide not updated!

Usage

import (
	"appengine"
	"github.com/tianhai82/gae_authen"
)
c := appengine.NewContext(r)

// Create new Authen instance
authen := NewAuthen(c, []byte("your 512 bits secret key"))

// create user
user, err := authen.CreateUser("testUser", []byte("P@ssw0rd"))

// try logging in
jwtTokenString, err = authen.Login("testUser", []byte("P@ssw0rd"))

// check whether user is still logged in (jwtTokenString is valid and not expired)
// will be called on every http request
// JWT token is implemented using https://github.com/dgrijalva/jwt-go
// to read claim values from the token, please read instruction at https://github.com/dgrijalva/jwt-go
jwtToken, err := authen.ParseToken(tokenString)

About

A simple user creation and login module for Google App Engine in Golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages