Skip to content

Commit

Permalink
Merge pull request #60 from jbodah/patch-1
Browse files Browse the repository at this point in the history
Clarify .encode API in README
  • Loading branch information
excpt committed Mar 4, 2015
2 parents 2706da8 + ff8a90b commit a03772e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ A Ruby implementation of [JSON Web Token draft 06](http://self-issued.info/docs/

## Usage

JWT.encode({"some" => "payload"}, "secret")
payload = {"some" => "payload"}
JWT.encode(payload, "secret")

Note the resulting JWT will not be encrypted, but verifiable with a secret key.

Expand All @@ -17,6 +18,10 @@ If the secret is wrong, it will raise a `JWT::DecodeError` telling you as such.

JWT.decode("someJWTstring", nil, false)

`encode` also allows for different signing algorithms as well as customer headers.

JWT.encode(payload, secret, "RS256", {"some" => "header"})

## Algorithms

The JWT spec supports several algorithms for cryptographic signing. This library currently supports:
Expand Down

0 comments on commit a03772e

Please sign in to comment.