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



39
40
41
# File 'lib/omniauth/strategies/todoist.rb', line 39

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



45
46
47
# File 'lib/omniauth/strategies/todoist.rb', line 45

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

#raw_infoObject



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

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



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

def request_phase
  super
end