Strategy token.
Check whether authentication credentials are present.
Select authentication parameters.
Sends authorization request to GitHub.
Check whether basic authentication credentials are present.
Setup OAuth2 instance.
Makes request to token endpoint and retrieves access token value.
21 22 23 24
# File 'lib/github_api/authorization.rb', line 21 def auth_code _verify_client client.auth_code end#authenticated? ⇒ Boolean
Check whether authentication credentials are present
49 50 51
# File 'lib/github_api/authorization.rb', line 49 def authenticated? basic_authed? || oauth_token? end#authentication ⇒ Object
Select authentication parameters
61 62 63 64 65 66 67
# File 'lib/github_api/authorization.rb', line 61 def authentication if basic_authed? { login: login, password: password } else {} end end
Sends authorization request to GitHub.
Parameters:redirect_uri
- Optional string.
:scope
- Optional string. Comma separated list of scopes. Available scopes:
(no scope) - public read-only access (includes public user profile info, public repo info, and gists).
user
- DB read/write access to profile info only.
public_repo
- DB read/write access, and Git read access to public repos.
repo
- DB read/write access, and Git read access to public and private repos.
gist
- write access to gists.
37 38 39 40
# File 'lib/github_api/authorization.rb', line 37 def authorize_url(params = {}) _verify_client client.auth_code.authorize_url(params) end#basic_authed? ⇒ Boolean
Check whether basic authentication credentials are present
54 55 56
# File 'lib/github_api/authorization.rb', line 54 def basic_authed? basic_auth? || (login? && password?) end#client ⇒ Object
9 10 11 12 13 14 15 16 17 18
# File 'lib/github_api/authorization.rb', line 9 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#get_token(authorization_code, params = {}) ⇒ Object
Makes request to token endpoint and retrieves access token value
43 44 45 46
# File 'lib/github_api/authorization.rb', line 43 def get_token(authorization_code, params = {}) _verify_client client.auth_code.get_token(authorization_code, params) end
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4