Last active
September 12, 2015 15:33
-
-
Save msuzoagu/e916cbbc0293a1ca5922 to your computer and use it in GitHub Desktop.
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 'sinatra' | |
| require 'oauth2' | |
| require 'dotenv' | |
| Dotenv.load | |
| require 'pry' | |
| require 'json' | |
| module Trelloizer2 | |
| class App2 < Sinatra::Application | |
| configure do | |
| enable :sessions | |
| end | |
| get '/' do | |
| "Hello World" | |
| end | |
| get '/auth' do | |
| # create instance of client (app making the request) | |
| client = OAuth2::Client.new( | |
| ENV["CLIENT_ID"], | |
| ENV["CLIENT_SECRET"], | |
| :site => 'http://github.com', | |
| :request_token_path => "https://github.com/login/oauth/authorize" | |
| ) | |
| binding.pry | |
| auth_url = client.auth_code.authorize_url(:redirect_uri => redirect_url) | |
| redirect auth_url | |
| end | |
| get '/callback' do | |
| binding.pry | |
| token = client.auth_code.get_token('authorization_code_value', :redirect_url => 'http://localhost:8080/oauth2/callback', :headers => {'Authorization' => 'Basic some_password'}) | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment