module RailsJwt::Controllers::Authentication
Constants
- SECRET_KEY
Public Instance Methods
decode(token)
click to toggle source
# File lib/rails_jwt/controllers/authentication.rb, line 13 def decode(token) decode = JWT.decode(token, SECRET_KEY)[0] HashWithIndifferentAccess.new decode end
encode(payout, exp = 1.month.from_now)
click to toggle source
TODO refactor to allow users to ad there own expiration date
# File lib/rails_jwt/controllers/authentication.rb, line 7 def encode(payout, exp = 1.month.from_now) payout[:exp] = exp.to_i JWT.encode(payout, SECRET_KEY) end