Created
April 7, 2015 13:21
-
-
Save fabiofumarola/d09380b8c598d6347caa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import play.api.libs.json.Json | |
import io.really.jwt._ | |
val payload = Json.obj("name" -> "Ahmed", "email" -> "ahmed@gmail.com") | |
val jwt = JWT.encode("secret", payload) | |
JWT.decode(jwt, Some("secret")) | |
scala> val jwt = JWT.encode("secret", payload) | |
jwt: String = eyJhbGciOiJIbWFjU0hBMjU2IiwidHlwIjoiSldUIn0.eyJuYW1lIjoiQWhtZWQiLCJlbWFpbCI6ImFobWVkQGdtYWlsLmNvbSJ9.I8avF3Tvv70KXDbvv73vv71kae-_vW7vv73vv70I77-977-9We-_vT5oWA8s77-977-977-9FQ | |
scala> JWT.decode(jwt, Some("secret")) | |
res2: io.really.jwt.JWTResult = JWT(JWTHeader(HmacSHA256,{}),{"name":"Ahmed","email":"ahmed@gmail.com"}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment