To allow devices to start verifications, you'll need to provide a JWT to the devices.
An optional value to change the number of verification code digits sent. The default value is 4, and acceptable values are 4-10.
An epoch timestamp that sets the expiration date of this token. The default and maximum value is 1 hour. For security reasons, expired JWTs are rejected and the issue date is taken into account.
require 'jwt'
post "/verify/token" do
param :phone_number, String, required: true
payload = {
app_id: ENV["APP_ID"],
phone_number: params[:phone_number],
iat: Time.now.to_i
}
jwt_token = JWT.encode(payload, ENV["AUTHY_API_KEY"], "HS256")
respond_with status: 200, body: {jwt_token: jwt_token}
end