title: Getting username and group info from Azure using adal4j
body: <p>I am developing a mobile app in which I need to authenticate a user against Azure AD. Basically the user will be prompted their organisational email and password, which the mobile phone app sends to the backend server which will authenticate.</p>
  
  <p>I have the 'public-client-app-sample' of 'azure-activedirectory-library-for-java' working, and can authenticate against 'graph.windows.net': </p>
  
  <pre class="lang-cs prettyprint-override"><code>private static AuthenticationResult getAccessTokenFromUserCredentials(
          String username, String password) throws Exception {
      AuthenticationContext context = null;
      AuthenticationResult result = null;
      ExecutorService service = null;
      try {
          service = Executors.newFixedThreadPool(1);
          context = new AuthenticationContext(AUTHORITY, false, service);
          Future&lt;AuthenticationResult&gt; future = context.acquireToken(
                  "https://graph.windows.net", CLIENT_ID, username, password,
                  null);
          result = future.get();
      } finally {
          service.shutdown();
      }
  
      if (result == null) {
          throw new ServiceUnavailableException(
                  "authentication result was null");
      }
      return result;
  }
  </code></pre>
  
  <p>However, this does not return any userInfo (is null), and I can't figure out at this moment how to query to get a list with groups the user belongs to?</p>
  
  <p>Do I just do manual lookups using the API using the tokens obtained from Adal4j, or is there a provided function within the library?</p>
  
  <p>I am only starting with Azure, so it might be obvious, I might just be looking in the wrong places. I tried e.g. '<a href="https://graph.windows.net/xxx.com/groups?api-version=1.5" rel="nofollow noreferrer">https://graph.windows.net/xxx.com/groups?api-version=1.5</a>' but get 'Resource 'https://graph.windows.net/xxx.com/groups?api-version=1.5' is not registered for the account.'</p>