Class: OmniAuth::Strategies::AngelList

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

Overview

Authenticate to AngelList utilizing OAuth 2.0 and retrieve basic user information.

Examples:

Basic Usage

use OmniAuth::Strategies::AngelList, 'API Key', 'Secret Key'

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) ⇒ AngelList

Returns a new instance of AngelList.

Parameters:

  • app (Rack Application)

    standard middleware application parameter

  • client_id (String) (defaults to: nil)

    the application id as registered on AngelList

  • client_secret (String) (defaults to: nil)

    the application secret as registered on AngelList



15
16
17
18
19
20
21
22
23
# File 'lib/omniauth/strategies/oauth2/angellist.rb', line 15

def initialize(app, client_id=nil, client_secret=nil, options={}, &block)
  client_options = {
    :site => 'https://api.angel.co/',
    :authorize_url => 'https://angel.co/api/oauth/authorize',
    :token_url => 'https://angel.co/api/oauth/token'
  }

  super(app, :angellist, client_id, client_secret, client_options, options, &block)
end

Instance Method Details

#auth_hashObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/omniauth/strategies/oauth2/angellist.rb', line 25

def auth_hash
  OmniAuth::Utils.deep_merge(
    super, {
      'uid' => user_data['id'],
      'user_info' => ,
      'extra' => {
        'user_hash' => user_data,
      }
    }
  )
end

#user_dataObject



49
50
51
52
53
54
# File 'lib/omniauth/strategies/oauth2/angellist.rb', line 49

def user_data
  @data ||= begin
    @access_token.options[:mode] = :query
    @access_token.get('/1/me').parsed
  end
end

#user_infoObject



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/omniauth/strategies/oauth2/angellist.rb', line 37

def 
  {
    'name' => user_data['name'],
    'bio' => user_data['bio'],
    'image' => user_data['image'],
    'urls' => {
      'AngelList' => user_data['angellist_url'],
      'Website' => user_data['online_bio_url']
    },
  }
end