Class: OmniAuth::Strategies::Todoist

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

Constant Summary collapse

DEFAULT_SCOPE =
'data:read'

Instance Method Summary collapse

Instance Method Details

#callback_phaseObject



36
37
38
# File 'lib/omniauth/strategies/todoist.rb', line 36

def callback_phase
    super
end

#callback_urlObject

Bugfix for regression introduced after omniauth-oauth2 v1.3.1 details: github.com/intridea/omniauth-oauth2/issues/81



42
43
44
# File 'lib/omniauth/strategies/todoist.rb', line 42

def callback_url
  options[:callback_url] || full_host + script_name + callback_path
end

#raw_infoObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/omniauth/strategies/todoist.rb', line 46

def raw_info
  unless @raw_info
     = access_token.post("/API/v7/sync", { 
      body: { 
        token: access_token.token, 
        sync_token: "*", 
        resource_types: '["user"]' }, 
      headers: {
        "Content-Type"=>"application/x-www-form-urlencoded" }
    }).parsed
    if ["user"]  
      @raw_info = ["user"]
    else
      @raw_info = {}
    end
  end
  @raw_info
end

#request_phaseObject



32
33
34
# File 'lib/omniauth/strategies/todoist.rb', line 32

def request_phase
  super
end