Skip to content

Commit 5ac8ced

Browse files
authored
Merge pull request #7 from Mailbutler/master
Allow for definition of redirect URL and use displayName
2 parents dcf2174 + adfd75e commit 5ac8ced

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/omniauth/strategies/microsoft_graph.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ class MicrosoftGraph < OmniAuth::Strategies::OAuth2
3131
'params' => access_token.params
3232
}
3333
end
34+
35+
def callback_url
36+
options[:redirect_uri] || (full_host + script_name + callback_path)
37+
end
3438

3539
def raw_info
3640
@raw_info ||= access_token.get('https://graph.microsoft.com/v1.0/me').parsed
@@ -47,7 +51,7 @@ def authorize_params
4751
end
4852

4953
def full_name
50-
raw_info.values_at("givenName", "surname").compact.join(' ')
54+
raw_info["displayName"].presence || raw_info.values_at("givenName", "surname").compact.join(' ')
5155
end
5256
end
5357
end

0 commit comments

Comments
 (0)