Class: OmniAuth::Strategies::GitHub

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/github.rb

Overview

OAuth 2.0 based authentication with GitHub. In order to sign up for an application, you need to [register an application](github.com/account/applications/new) and provide the proper credentials to this middleware.

Instance Attribute Summary

Attributes inherited from OAuth2

#client_id, #client_options, #client_secret, #options

Instance Method Summary collapse

Methods inherited from OAuth2

#callback_url, #client

Constructor Details

#initialize(app, client_id = nil, client_secret = nil, options = {}, &block) ⇒ GitHub

Returns a new instance of GitHub.

Parameters:

  • app (Rack Application)

    standard middleware application argument

  • client_id (String) (defaults to: nil)

    the application ID for your client

  • client_secret (String) (defaults to: nil)

    the application secret



13
14
15
16
17
18
19
20
21
# File 'lib/omniauth/strategies/github.rb', line 13

def initialize(app, client_id = nil, client_secret = nil, options = {}, &block)
  client_options = {
    :site => 'https://github.com/',
    :authorize_path => '/login/oauth/authorize',
    :access_token_path => '/login/oauth/access_token'
  }
  
  super(app, :github, client_id, client_secret, client_options, options, &block)
end