gem install iauth
echo "gem 'iauth'" >> Gemfile
require 'iauth'
require 'securerandom'
iauth = IAuth.new 'your app id here', 'your app secret here'
state = SecureRandom 8
login_url = iauth.login_url state
# redirect to login url, when logged in, it will redirect to callback url with param verifier and state
# if it redirected to login callback url, use `iauth.auth`, else `iauth.login`
iauth.auth verifier, state
MIT License