module Octokit::Client::Authorizations
Overview
Methods for the Authorizations API
See Api:
Direct including types
Defined in:
octokit/client/authorizations.crInstance Method Summary
-
#authorizations(number : Int32) : Authorization
Get a single authorization for the authenticated user.
-
#authorizations(**options) : Connection::Paginator(Authorization)
List the authenticated user's authorizations.
-
#authorize_url(app_id = client_id, **options) : String
Get the URL to authorize a user for an application via the web flow.
-
#check_application_authorization(token, key = client_id) : Authorization
Check if a token is valid.
-
#create_authorization(*, client_id = nil, client_secret = nil, scopes = [] of String, note = nil, note_url = nil, idempotent = nil, fingerprint = nil) : Authorization
Create an authorization for the authenticated user.
-
#delete_authorization(number : Int32) : Bool
Delete an authorization for the authenticated user.
-
#reset_application_authorization(token, key = client_id) : Authorization
Reset a token.
-
#revoke_application_authorization(token, key = client_id) : Authorization
Revoke a token.
-
#scopes(token = @access_token, headers = nil) : Array(String)
Check scopes for a token.
-
#update_authorization(number : Int32, **options) : Authorization
Update an authorization for the authenticated user.
Instance Method Detail
Get a single authorization for the authenticated user.
You can only access your own tokens, and only through Basic Authentication.
See Also:
Example:
@client = Octokit.client("watzon", "PASSWORD")
@client.authorization(999999)
List the authenticated user's authorizations.
API for users to manage their own tokens. You can only access your own tokens, and only through Basic Authentication.
See Also:
Example:
@client = Octokit.client("watzon", "PASSWORD")
@client.authorizations
Get the URL to authorize a user for an application via the web flow.
See Also:
Example:
@client.authorize_url("xxxx")
Check if a token is valid.
See Also:
Example:
@client = Octokit.client(client_id: "abcdefg12345", client_secret: "secret")
@client.check_application_authorization("deadbeef1234567890deadbeef987654321")
Create an authorization for the authenticated user.
You can only access your own tokens, and only through Basic Authentication.
See Also:
- https://developer.github.com/v3/oauth/#scopes
- https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization
- https://developer.github.com/v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app
Example:
@client = Octokit.client("watzon", "PASSWORD")
@client.create_authorization(idempotent: true, client_id: "xxxx", client_secret: "yyyy", scopes: ["user"])
Delete an authorization for the authenticated user.
You can only access your own tokens, and only through Basic Authentication.
See Also:
Example:
@client = Octokit.client("watzon", "PASSWORD")
@client.delete_authorization(999999)
Reset a token.
See Also:
Example:
@client = Octokit.client(client_id: "abcdefg12345", client_secret: "secret")
@client.reset_application_authorization("deadbeef1234567890deadbeef987654321")
Revoke a token.
See Also:
Example:
@client = Octokit.client(client_id: "abcdefg12345", client_secret: "secret")
@client.revoke_application_authorization("deadbeef1234567890deadbeef987654321")
Update an authorization for the authenticated user.
You can only access your own tokens, and only through Basic Authentication.
See Also:
- https://developer.github.com/v3/oauth_authorizations/#update-an-existing-authorization
- https://developer.github.com/v3/oauth/#scopes
Example:
@client = Octokit.client("watzon", "PASSWORD")
@client.update_authorization(999999, add_scopes: ["gist", "repo"], note: "Why not Zoidberg possibly?")