title: Using Nexmo Verify to Login to a Ruby Sinatra App
body: <p>I have found a <a href="https://www.nexmo.com/blog/2016/06/07/two-factor-authentication-2fa-ruby-rails-devise-nexmo-verify/" rel="nofollow">ruby on rails 2fa nexmo verify tutorial</a> but some of it doesn't work on Sinatra because the frameworks have some differences and it doesn't fit what I'm making. Can anyone help me out or lead me in the path of using <a href="https://www.nexmo.com/products/verify/" rel="nofollow">Nexmo Verify</a> in my Sinatra app?</p>
  
  <pre><code>post "/" do
    client = Nexmo::Client.new(key: 'mykey', secret: 'mysecret')
    response = client.send_verification_request(number   params[:phonenumber], brand: 'OpenINC')
    if response['status'] == '0'
      erb :code
    else
      erb :error
    end
  end
  
  get'/code' do
    erb :code
  end
  
  post '/code' do
    client = Nexmo::Client.new(key: 'mykey', secret: 'mysecret')
    response = client.check_verification_request(code: '1234', request_id: '00e6c3377e5348cdaf567e1417c707a5')
  
    if response['status'] == '0'
      erb :start
    else
      erb :error
    end
  end
  </code></pre>
  
  <p>Where it says mykey and mysecret I put my key and secret but just didn't want to put my actual key and secret on Stack OverFlow</p>