Class: OmniAuth::Strategies::Todoist

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

Instance Method Summary collapse

Instance Method Details

#callback_urlObject

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



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

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

#raw_infoObject



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

def raw_info
  @raw_info ||= begin
    params = {
      headers: {
        "Content-Type" => "application/x-www-form-urlencoded"
      },
      body: {
        token: access_token.token,
        sync_token: "*",
        resource_types: '["user"]'
      }
    }
    access_token.post("https://api.todoist.com/sync/v8/sync", params).parsed.fetch('user', {})
  end
end