This file contains hidden or 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
def index | |
authorize_oauth2 | |
end | |
def authorize_oauth2 | |
# Redirect to /authorization endpoint | |
redirect_to client.auth_code.authorize_url(:state => 'thisisatest', :redirect_uri => REDIRECT_URI) | |
end | |
def accept |
This file contains hidden or 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
require 'oauth' | |
# Fill the keys and secrets you retrieved after registering your app | |
api_key = 'abcd123456' | |
api_secret = 'efgh987654' | |
user_token = 'abcd1234-efgh987-9988' | |
user_secret = '9876abcd-123asdf-1122' | |
# Specify LinkedIn API endpoint | |
configuration = { :site => 'https://www.linkedin.com' } |
This file contains hidden or 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
require 'oauth2' | |
require 'net/http' | |
require 'uri' | |
API_KEY = 'XXXXXXXXX' #Your app's API key | |
API_SECRET = 'XXXXXXXXXXXXX' #Your app's API secret | |
REDIRECT_URI = 'http://localhost:3000/accept' #Redirect users after authentication to this path | |
#Instantiate your OAuth2 client object | |
def client |