Skip to content
/ ejwt Public
forked from kato-im/ejwt

an easy to use json webtoken library, written in Erlang

License

Notifications You must be signed in to change notification settings

indigo-dc/ejwt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Erlang JWT Library

JWT is a simple authorization token format based on JSON. Peter Hizalev started this library at Kato.im and put it under open-source. The library was enhanced with tests, stylechecking and the RS256 algorithm.

Smoke test example

Compilation

   make
   make tests

In Erlang shell:

%% Create JWT token
application:start(crypto).
Key = <<"53F61451CAD6231FDCF6859C6D5B88C1EBD5DC38B9F7EBD990FADD4EB8EB9063">>.
Claims = {[
    {user_id, <<"bob123">>},
    {user_name, <<"Bob">>}
]}.
ExpirationSeconds = 86400,
Token = ejwt:jwt(hs256, Claims, ExpirationSeconds, Key).

%% Parse JWT token
ejwt:parse_jwt(Token, Key).

You should get back the original claims Jterm, plus expiration claim:

{[
    {<<"exp">>,1392607527},
    {<<"user_id">>,<<"bob123">>},
    {<<"user_name">>,<<"Bob">>}
]}

About

an easy to use json webtoken library, written in Erlang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Erlang 98.2%
  • Makefile 1.8%