public TokenAuthData getOAuthTokenCode() throws Exception {

    OkHttpClient client = TestHelper.createTestBuilder(callbackHost).build();

    AuthDataGenerator authDataGenerator = new MicrosoftAuthServiceExtension()
        .getAuthDataGenerator(DataVertical.CONTACTS, AuthMode.EXPORT);

    AuthFlowConfiguration configuration = authDataGenerator
        .generateConfiguration(callbackBase, "1");

    Desktop desktop = Desktop.getDesktop();

    desktop.browse(new URI(configuration.getAuthUrl()));

    // Execute the request and retrieve the auth code.
    String authCode = retrieveAuthCode(client);

    // get the token
    TokenAuthData tokenData = (TokenAuthData)
        authDataGenerator.generateAuthData(
            callbackBase, authCode, "1", configuration.getInitialAuthData(), null);

    // System.out.println("TOKEN: " + tokenData.getToken());
    return tokenData;
  }
Performs an OAuth flow using the general AuthDataGenerator, returning a token.

@return the token
extensions/auth/portability-auth-harness-microsoft/src/main/java/org/datatransferproject/auth/microsoft/harness/AuthTestDriver.java