class OmniAuth::Strategies::MicrosoftOffice365
Constants
- DEFAULT_SCOPE
Public Instance Methods
raw_info()
click to toggle source
# File lib/omniauth/strategies/microsoft_office365.rb, line 40 def raw_info @raw_info ||= access_token.get("https://graph.microsoft.com/v1.0/me").parsed end
Private Instance Methods
avatar_file()
click to toggle source
# File lib/omniauth/strategies/microsoft_office365.rb, line 62 def avatar_file photo = access_token.get("https://graph.microsoft.com/v1.0/me/photo/$value") ext = photo.content_type.sub("image/", "") # "image/jpeg" => "jpeg" Tempfile.new(["avatar", ".#{ext}"]).tap do |file| file.binmode file.write(photo.body) file.rewind end rescue ::OAuth2::Error => e if e.response.status == 404 # User has no avatar... return nil elsif e.code['code'] == 'GetUserPhoto' && e.code['message'].match('not supported') nil else raise end end
callback_url()
click to toggle source
# File lib/omniauth/strategies/microsoft_office365.rb, line 58 def callback_url options[:redirect_uri] || (full_host + script_name + callback_path) end