Created
December 11, 2018 16:06
-
-
Save chadwilken/f592395f028bd7a7ca923e04db6e7446 to your computer and use it in GitHub Desktop.
OAuth 2 Flow
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
client = OAuth2::Client.new(ENV['COMPANYCAM_UID'], ENV['COMPANYCAM_SECRET'], site: 'https://app.companycam.com') | |
# Get a auth URL to redirect user to | |
client.auth_code.authorize_url(redirect_uri: 'https://yoursite.com/oauth/companycam/callback') | |
# The user will accept of deny and then be redirected to the URL above | |
# the URL will have a parameter `code` if the user accepted. | |
# You will take the code and POST back to exchange for an access_token and refresh_token | |
client.auth_code.get_token(params[:code], redirect_uri: 'https://yoursite.com/oauth/companycam/callback') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment