title: GWT Getting Google User's Name After Successful OAuth Login
body: <p>In my GWT application, I am using the <code>com.google.api.gwt.oauth2.OAuth2</code> module to allow users to signin with OAuth.  I have implemented a GoogleApi class to provide the OAuth login as follows:</p>
  
  <pre class="lang-java prettyprint-override"><code>public final class GoogleApi {
      private EventBus eventBus;
  
      private final ClientOAuth2Login oAuth2Login;
      private ClientGoogleApiRequestTransport requestTransport;
  
      private String accessToken;
  
      public GoogleApi(final EventBus eventBus, String clientId) {
          this.eventBus = eventBus;
          oAuth2Login = new ClientOAuth2Login(clientId);
      }
  
      ...
  
      public void login(final Receiver&lt;String&gt; callback) {
          oAuth2Login.login(new Receiver&lt;String&gt;() {
              @Override
              public void onSuccess(String response) {
                  accessToken = response;
                  callback.onSuccess(response);
              }
  
              @Override
              public void onFailure(ServerFailure error) {
                  Window.alert(error.getMessage());
              }
          });
      }
      ...
  }
  </code></pre>
  
  <p>I am calling this login() method as follows:</p>
  
  <pre class="lang-java prettyprint-override"><code>googleApi.login(new Receiver&lt;String&gt;() {
      @Override
      public void onSuccess(final String token) {
          // I want to get the logged in user's name here
      }
  
      @Override
      public void onFailure(ServerFailure error) {
          ...
      }
  });
  </code></pre>
  
  <p>After successful login, I want to get the logged in user's full name.  I know that I can get the user's name using the <code>com.google.api.gwt.services.Plus</code> module, but that requires users to be registered to Google Plus and throws an error if they're not.</p>
  
  <p><strong>How can I do this using OAuth in my GWT app?</strong>  Basically, I want to be able to implement <a href="https://stackoverflow.com/a/7115414">this solution</a> in a GWT app, if possible.</p>