jwt — Erlang JWT Library
JWT is a simple authorization token format based on JSON.
Usage example
%% Create JWT token
> application:ensure_all_started(jwt).
> Key = <<"supas3cri7">>.
> Claims = [
{user_id, 42},
{user_name, <<"Bob">>}
].
> {ok, Token} = jwt:encode(<<"HS256">>, Claims, Key).
%% or with expiration
> ExpirationSeconds = 86400.
> {ok, Token} = jwt:encode(<<"HS256">>, Claims, ExpirationSeconds, Key).
%% Parse JWT token
> {ok, Claims} = jwt:decode(Token, Key).
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request