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



53
54
55
56
57
# File 'lib/omniauth/strategies/mastodon.rb', line 53

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

#callback_phaseObject



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

def callback_phase
  set_options_from_identifier
  super
end

#callback_urlObject



49
50
51
# File 'lib/omniauth/strategies/mastodon.rb', line 49

def callback_url
  full_host + script_name + callback_path
end

#raw_infoObject



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

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



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

def request_phase
  identifier ? start_oauth : get_identifier
end