Last active
September 3, 2019 15:16
-
-
Save jeffdonthemic/089f676bfcaa0ab6c16df87c3d0e54e1 to your computer and use it in GitHub Desktop.
Refresh Token from Salesforce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
require 'sinatra' | |
require 'omniauth' | |
require 'omniauth-salesforce' | |
rescue LoadError | |
require 'rubygems' | |
require 'sinatra' | |
require 'omniauth' | |
require 'omniauth-salesforce' | |
end | |
set :port, 3000 | |
use Rack::Session::Cookie | |
use OmniAuth::Builder do | |
provider :salesforce, ENV['TEST_SALESFORCE_CLIENT_ID'], ENV['TEST_SALESFORCE_CLIENT_SECRET'] | |
end | |
get '/' do | |
<<-HTML | |
<h1>Sign into Salesforce and get a refresh token. Try it... it's fun!</h1> | |
<a href='/auth/salesforce'>Sign into Salesforce</a> with your xxx@sriracha.trailhead.com account | |
HTML | |
end | |
get '/auth/:name/callback' do | |
auth = request.env['omniauth.auth'] | |
puts auth | |
"Here is your handy-dandy refresh token: #{auth['credentials']['refresh_token']}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment