Class: OmniAuth::Strategies::Mastodon

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

Constant Summary collapse

DEFAULT_SCOPE =
'read'.freeze

Instance Method Summary collapse

Instance Method Details

#authorize_paramsObject



55
56
57
58
59
# File 'lib/omniauth/strategies/mastodon.rb', line 55

def authorize_params
  super.tap do |params|
    params[:scope] ||= DEFAULT_SCOPE
  end
end

#callback_phaseObject



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

def callback_phase
  set_options_from_identifier
  super
end

#callback_urlObject



51
52
53
# File 'lib/omniauth/strategies/mastodon.rb', line 51

def callback_url
  full_host + script_name + callback_path
end

#raw_infoObject



47
48
49
# File 'lib/omniauth/strategies/mastodon.rb', line 47

def raw_info
  @raw_info ||= access_token.get('api/v1/accounts/verify_credentials').parsed
end

#request_phaseObject

Before we can redirect the user to authorize access, we must know where the user is from If the identifier param is not already present, a form will be shown for entering it



37
38
39
40
# File 'lib/omniauth/strategies/mastodon.rb', line 37

def request_phase
  # identifier ? start_oauth : get_identifier
  start_oauth
end