Skip to content

Commit

Permalink
update readme & remove update from changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanspagh committed Oct 24, 2016
1 parent 359ed4e commit 5fd4edf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
6 changes: 0 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@
* Fixes for ttl and exp
* Added integration tests

#v 0.12.1

* Adds long living refresh tokens which can be exchanged to shorter living access tokens

# v 0.12.0

* Add `one_of` to permissions Plug to allow for OR'd sets of permissions as well as AND'd ones
* Fix infinite recursion bug when joining channels


# v 0.11.1

* Support for secret keys other than "oct" which provides support for signature
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -491,9 +491,20 @@ end
Once the new token is created, the old one is revoked before returning the new
token.

### Refresh Tokens
### Exhange Tokens

You can create refresh token, which by default are long living. These can later be exchanged for shorter living access tokens, which can be used as a authorization token.
You can exchange one type of token to an other given that the first is valid
This can be used to issue long living tokens that can be exchanged for shorter living ones

```elixir
# issue a long living refresh token
{:ok, jwt, claims} = Guardian.encode_and_sign(resource, "refresh")
# exchange the refresh token for a access token
{:ok, access_jwt, new_claims} = Guardian.exchange(jwt, "refresh", "access")
```


The old token wont be revoked after the exchange

```elixir
# issue a long living refresh token
Expand Down

0 comments on commit 5fd4edf

Please sign in to comment.