Strategy token
# File lib/github_api/authorization.rb, line 20 def auth_code _verify_client client.auth_code end
Check whether authentication credentials are present
# File lib/github_api/authorization.rb, line 48 def authenticated? basic_authed? || oauth_token? end
Select authentication parameters
# File lib/github_api/authorization.rb, line 58 def authentication if basic_auth? { :basic_auth => basic_auth } elsif login? && password? { :login => login, :password => password } else { } end end
Check whether basic authentication credentials are present
# File lib/github_api/authorization.rb, line 53 def basic_authed? basic_auth? || (login? && password?) end
Setup OAuth2 instance
# File lib/github_api/authorization.rb, line 8 def client @client ||= ::OAuth2::Client.new(client_id, client_secret, { :site => current_options.fetch(:site) { Github.site }, :authorize_url => 'login/oauth/authorize', :token_url => 'login/oauth/access_token', :ssl => { :verify => false } } ) end
Makes request to token endpoint and retrieves access token value
# File lib/github_api/authorization.rb, line 42 def get_token(authorization_code, params = {}) _verify_client client.auth_code.get_token(authorization_code, params) end