gem install webtoken
require 'webtoken'
data = WebToken::MakeToken.new( user_id )
data.web_token
#sample = {"eyJhbGciOiJub25lIn0.eyJkYXRhIjp7InVzZXJpZCI6ImpodiIsImRhdGUiOiIyMDE4LTA1LTI1IiwidGltZSI6IjIwMTgtMDUtMjUgMTI6Mzk6MzIgKzA1MzAifX0."}
validate_token = WebToken::WebtokenValidate.new
validate_token.validate( 'your token' )
{"userid" : "userid", date: "date", time: "time"} #access token valid
false #access token invalid
https://rubygems.org/gems/webtoken