Community maintained clone of https://github.com/dgrijalva/jwt-go
Go to file
Dave Grijalva 8d78d69a0e Merge pull request #16 from dgrijalva/example_app
A basic, mildly useful example app
2014-05-20 15:23:41 -07:00
cmd/jwt clean up todos 2014-05-20 14:54:44 -07:00
test almost working 2012-04-17 18:41:12 -07:00
.gitignore a useful example app 2014-05-19 20:13:39 -07:00
LICENSE mit license 2012-04-18 12:02:05 -07:00
README.md Fix typo: null -> nil in README 2014-04-09 17:26:16 -04:00
jwt.go jwt.ValidationError didn't not implement error 2014-05-17 01:18:17 +02:00
jwt_test.go switched error details to bitfield 2014-03-09 12:24:51 -07:00
rs256.go gofmt 2013-02-26 21:29:51 -08:00
rs256_test.go refactor test code 2014-01-02 19:14:07 +02:00
sha256.go gofmt 2012-07-06 17:02:20 -07:00
sha256_test.go GetSigningMethod only returns method - fixes failing tests with go 1.1.2 2013-10-07 22:01:07 -07:00
signing_method.go fixes 2012-07-07 12:12:49 -07:00

README.md

A golang implementation of JSON Web Tokens

This library supports the parsing and verification as well as the generation and signing of JWTs. Current supported signing algorithms are RSA256 and HMAC SHA256.

This library is considered production ready. Feedback and feature requests are appreciated.

Parse and Verify

	token, err := jwt.Parse(myToken, func(token *jwt.Token) ([]byte, error) {
		return myLookupKey(token.Header["kid"])
	})

	if err == nil && token.Valid {
		deliverGoodness("!")
	} else {
		deliverUtterRejection(":(")
	}

Create a token

	token := jwt.New(jwt.GetSigningMethod("HS256"))
	token.Claims["foo"] = "bar"
	token.Claims["exp"] = time.Now().Add(time.Hour * 72).Unix()
	tokenString, err := token.SignedString(mySigningKey)

Documentation can be found here