Skip to content

Instantly share code, notes, and snippets.

@israelb
Created March 12, 2019 15:14
Show Gist options
  • Save israelb/054e1d6f9e5092f2487253bb17bf8108 to your computer and use it in GitHub Desktop.
Save israelb/054e1d6f9e5092f2487253bb17bf8108 to your computer and use it in GitHub Desktop.
test jwt
require 'json_web_token'
data = { "City" => "REGION METROPOLITANA",
"Last_Name" => "Dominguez",
"Exterior_Number" => "",
"CURP" => "",
"Loan_Amount" => 23423.0,
"Monthly_Salary" => 234234.0,
"Second_Surname" => "",
"Email" => "aaron@destacame.cl",
"Direction" => "Laval",
"Interior_Number" => "",
"Country" => "México",
"Gender" => "m",
"Next_Payment_Date" => "",
"Job_Type" => 3,
"Loan_Purpose" => 1,
"Birthdate" => "19880811",
"Has_Bank_Account" => 1,
"RFC" => "aada880804",
"Postal_Code" => "20367",
"Has_Facebook" => 0,
"Dependents" => 234,
"First_Name" => "Aaron",
"State" => "SANTIAGO",
"Phone_No" => "950850103",
"Street" => "1638"
}
payload = { data: data }
hmac_secret = '79ab6c07b9ac409ab74c42b0ab800591'
# Sign with RSA SHA256 algorithm
opts = {
alg: 'HS256',
key: hmac_secret
}
jwt = JsonWebToken.sign(payload, opts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment