Skip to content

Commit 4c858d0

Browse files
committed
get email address from token
token will only contain this field if it's requested in scopes
1 parent cf6a2f5 commit 4c858d0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/uk/ac/cam/cl/dtg/segue/auth/MicrosoftAuthenticator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class MicrosoftAuthenticator implements IOAuth2Authenticator {
5151
.expireAfterAccess(CREDENTIAL_CACHE_TTL_MINUTES, TimeUnit.MINUTES)
5252
.build();
5353

54-
private final String scopes = "";
54+
private final String scopes = "email";
5555
private final String callbackURL = "http://localhost:8004/auth/microsoft/callback";
5656
private final String clientId;
5757
private final String tenantId;
@@ -127,7 +127,7 @@ public UserFromAuthProvider getUserInfo(String internalProviderReference) {
127127

128128
// TODO: to support sign-ups, parse more info
129129
return new UserFromAuthProvider(
130-
(String) idToken.getPayload().get("sub"), null, null, null,
130+
(String) idToken.getPayload().get("sub"), null, null, (String) idToken.getPayload().get("email"),
131131
null, null, null, null, null, null
132132
);
133133
} catch (Exception e) {

0 commit comments

Comments
 (0)