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