Class: JsonWebToken

Inherits:
Object
  • Object
show all
Defined in:
lib/json_web_token.rb

Class Method Summary collapse

Class Method Details

.decode(token) ⇒ Object



7
8
9
10
# File 'lib/json_web_token.rb', line 7

def decode(token)
  body = JWT.decode(token, Rails.application.secrets.secret_key_base)[0]
  HashWithIndifferentAccess.new body
end

.encode(payload) ⇒ Object



3
4
5
# File 'lib/json_web_token.rb', line 3

def encode(payload)
  JWT.encode(payload, Rails.application.secrets.secret_key_base)
end