Skip to content

Commit 3e01725

Browse files
committed
implemented microsofts oauth v2.0 support
1 parent 68b06db commit 3e01725

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/omniauth/strategies/microsoft_graph.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@ class MicrosoftGraph < OmniAuth::Strategies::OAuth2
66
option :name, :microsoft_graph
77

88
option :client_options, {
9-
site: 'https://login.microsoftonline.com/common/oauth2/authorize',
10-
token_url: 'https://login.microsoftonline.com/common/oauth2/token',
11-
authorize_url: 'https://login.microsoftonline.com/common/oauth2/authorize'
9+
site: 'https://login.microsoftonline.com/',
10+
token_url: 'common/oauth2/v2.0/token',
11+
authorize_url: 'common/oauth2/v2.0/authorize'
1212
}
1313

1414
option :authorize_params, {
15-
resource: 'https://graph.microsoft.com/'
1615
}
1716

1817
option :token_params, {
1918
resource: 'https://graph.microsoft.com/'
2019
}
2120

21+
option :scope, "https://graph.microsoft.com/profile https://graph.microsoft.com/email https://graph.microsoft.com/User.Read https://graph.microsoft.com/User.ReadBasic.All"
22+
2223
uid { raw_info["id"] }
2324

2425
info do
@@ -39,7 +40,7 @@ class MicrosoftGraph < OmniAuth::Strategies::OAuth2
3940
end
4041

4142
def raw_info
42-
@raw_info ||= access_token.get(authorize_params.resource + 'v1.0/me').parsed
43+
@raw_info ||= access_token.get(token_params.resource + 'v1.0/me').parsed
4344
end
4445
end
4546
end

0 commit comments

Comments
 (0)