I'm using the sample provided by Microsoft, I authenticate myself just fine. I retrieve basic info about my user after authenticating. How do I retrieve more info about my user (e.g. street number, house number, phone number etc.)?
- I'm using this Azure AD Spring Boot Backend Sample - Github
- I start & login (https://localhost:8080)
- Authentication success!
- I get basic info about the user (e.g. Name, Surname)
- How do I get more info about the user (e.g. Street Number, House Number, Phone Number)?
Code (HomeController.java):
@GetMapping("/")
public String index(Model model, OAuth2AuthenticationToken auth) {
final OAuth2AuthorizedClient client = this.authorizedClientService.loadAuthorizedClient(
auth.getAuthorizedClientRegistrationId(),
auth.getName());
// Name, Surname
model.addAttribute("userName", auth.getName());
model.addAttribute("pageTitle", "Welcome, "+auth.getName());
// Azure info
model.addAttribute("clientName", client.getClientRegistration().getClientName());
// HERE I WANT TO SEND A (MICROSOFT OR AD) GRAPH API REQUEST TO GET
// THIS USER'S ADDRESS (street number, house number, etc.)
return "index";
}