module Github::Authorization
def _verify_client # :nodoc:
def _verify_client # :nodoc: raise ArgumentError, 'Need to provide client_id and client_secret' unless client_id? && client_secret? end
def auth_code
def auth_code _verify_client client.auth_code end
def authenticated?
def authenticated? basic_authed? || oauth_token? end
def authentication
- Api: - public
def authentication if basic_authed? { login: login, password: password } else {} end end
def authorize_url(params = {})
* gist - write access to gists.
* repo - DB read/write access, and Git read access to public and private repos.
* public_repo - DB read/write access, and Git read access to public repos.
* user - DB read/write access to profile info only.
* (no scope) - public read-only access (includes public user profile info, public repo info, and gists).
Available scopes:
* :scope - Optional string. Comma separated list of scopes.
* :redirect_uri - Optional string.
= Parameters
Sends authorization request to GitHub.
def authorize_url(params = {}) _verify_client client.auth_code.authorize_url(params) end
def basic_authed?
def basic_authed? basic_auth? || (login? && password?) end
def client
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
def get_token(authorization_code, params = {})
def get_token(authorization_code, params = {}) _verify_client client.auth_code.get_token(authorization_code, params) end