private static void GetAPI(String username, String password)
throws IOException
{
HtmlUnitDriver driver = new HtmlUnitDriver();
driver.get(authUrlObject.toString());
List<WebElement> webElements = driver.findElementsByTagName("form");
WebElement usernameElement = driver.findElementById("username");
usernameElement.sendKeys(username);
WebElement passwordElement = driver.findElementById("password");
passwordElement.sendKeys(password);
webElements.get(0).submit();
CodeUrl codeUrl = new CodeUrl(driver.getCurrentUrl());
accessGrant = connectionFactory.getOAuthOperations().exchangeForAccess(codeUrl.getQueryMap().get(CodeUrl.CODE), REDIRECT_URI, null);
connection = connectionFactory.createConnection(accessGrant);
alfresco = connection.getApi();