Module: Octokit::Client::OauthApplications
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/octokit/client/oauth_applications.rb |
Overview
Methods for the OauthApplications
API
Instance Method Summary
-
#check_application_authorization(access_token, options = {})
Alias for #check_token.
-
#check_token(access_token, options = {}) ⇒ Sawyer::Resource
(also: #check_application_authorization)
Check if a token is valid.
-
#delete_app_authorization(access_token, options = {}) ⇒ Boolean
Delete an app authorization.
-
#delete_app_token(access_token, options = {}) ⇒ Boolean
(also: #delete_application_authorization, #revoke_application_authorization)
Delete an app token.
-
#delete_application_authorization(access_token, options = {})
Alias for #delete_app_token.
-
#reset_application_authorization(access_token, options = {})
Alias for #reset_token.
-
#reset_token(access_token, options = {}) ⇒ Sawyer::Resource
(also: #reset_application_authorization)
Reset a token.
-
#revoke_application_authorization(access_token, options = {})
Alias for #delete_app_token.
Instance Method Details
#check_application_authorization(access_token, options = {})
Alias for #check_token.
# File 'lib/octokit/client/oauth_applications.rb', line 32
alias check_token
#check_token(access_token, options = {}) ⇒ Sawyer::Resource
Also known as: #check_application_authorization
Check if a token is valid.
Applications can check if a token is valid without rate limits.
# File 'lib/octokit/client/oauth_applications.rb', line 21
def check_token(access_token, = {}) = ensure_api_media_type(:applications_api, .dup) [:access_token] = access_token key = .delete(:client_id) || client_id secret = .delete(:client_secret) || client_secret as_app(key, secret) do |app_client| app_client.post "applications/#{client_id}/token", end end
#delete_app_authorization(access_token, options = {}) ⇒ Boolean
Delete an app authorization
OAuth application owners can revoke a grant for their OAuth application and a specific user.
# File 'lib/octokit/client/oauth_applications.rb', line 102
def (access_token, = {}) = ensure_api_media_type(:applications_api, .dup) [:access_token] = access_token key = .delete(:client_id) || client_id secret = .delete(:client_secret) || client_secret begin as_app(key, secret) do |app_client| app_client.delete "applications/#{client_id}/grant", app_client.last_response.status == 204 end rescue Octokit::NotFound false end end
#delete_app_token(access_token, options = {}) ⇒ Boolean
Also known as: #delete_application_authorization, #revoke_application_authorization
Delete an app token
Applications can revoke (delete) a token
# File 'lib/octokit/client/oauth_applications.rb', line 71
def delete_app_token(access_token, = {}) = ensure_api_media_type(:applications_api, .dup) [:access_token] = access_token key = .delete(:client_id) || client_id secret = .delete(:client_secret) || client_secret begin as_app(key, secret) do |app_client| app_client.delete "applications/#{client_id}/token", app_client.last_response.status == 204 end rescue Octokit::NotFound false end end
#delete_application_authorization(access_token, options = {})
Alias for #delete_app_token.
# File 'lib/octokit/client/oauth_applications.rb', line 87
alias delete_app_token
#reset_application_authorization(access_token, options = {})
Alias for #reset_token.
# File 'lib/octokit/client/oauth_applications.rb', line 57
alias reset_token
#reset_token(access_token, options = {}) ⇒ Sawyer::Resource
Also known as: #reset_application_authorization
Reset a token
Applications can reset a token without requiring a user to re-authorize.
# File 'lib/octokit/client/oauth_applications.rb', line 46
def reset_token(access_token, = {}) = ensure_api_media_type(:applications_api, .dup) [:access_token] = access_token key = .delete(:client_id) || client_id secret = .delete(:client_secret) || client_secret as_app(key, secret) do |app_client| app_client.patch "applications/#{client_id}/token", end end
#revoke_application_authorization(access_token, options = {})
Alias for #delete_app_token.
# File 'lib/octokit/client/oauth_applications.rb', line 88
alias delete_app_token