public OAuthMigrationResponse migrate() throws ConnectionException {

		logger.debug("Enter OAuthMigrationClient::migrate");
		
		try {
			
			
			HttpRequestClient client = new HttpRequestClient(oAuthMigrationRequest.getOauth2config().getProxyConfig());
			
			//prepare post json
			String requestjson =  new JSONObject().put("scope", getScopeValue(oAuthMigrationRequest.getScope()))
    				.put("redirect_uri", getRedirectUrl() )
    				.put("client_id", oAuthMigrationRequest.getOauth2config().getClientId())
    				.put("client_secret",oAuthMigrationRequest.getOauth2config().getClientSecret())
    				.toString();
			
			Request request = new Request.RequestBuilder(MethodType.GET, getMigrationAPIUrl(oAuthMigrationRequest.getEnvironment()))
											.requiresAuthentication(true)
											.postJson(requestjson)
											.build(); 
			//make the API call
			Response response = client.makeJsonRequest(request, oAuthMigrationRequest);

			logger.debug("Response Code : " + response.getStatusCode());
			if (response.getStatusCode() == 200) {
				ObjectReader reader = mapper.readerFor(OAuthMigrationResponse.class);
				OAuthMigrationResponse oAuthMigrationResponse = reader.readValue(response.getContent());
				return oAuthMigrationResponse;

			} else {
				logger.debug("failed calling migrate API");
				throw new ConnectionException("failed calling migrate API", response.getStatusCode() + "");
			}
		} catch (Exception ex) {
			logger.error("Exception while calling migrate", ex);
			throw new ConnectionException(ex.getMessage(), ex);
		}
	}
public OAuthMigrationResponse migrate ( ) throws ConnectionException { logger . debug ( "Enter OAuthMigrationClient::migrate" ) ; try { HttpRequestClient client = new HttpRequestClient ( oAuthMigrationRequest . getOauth2config ( ) . getProxyConfig ( ) ) ; String requestjson = new JSONObject ( ) . put ( "scope" , getScopeValue ( oAuthMigrationRequest . getScope ( ) ) ) . put ( "redirect_uri" , getRedirectUrl ( ) ) . put ( "client_id" , oAuthMigrationRequest . getOauth2config ( ) . getClientId ( ) ) . put ( "client_secret" , oAuthMigrationRequest . getOauth2config ( ) . getClientSecret ( ) ) . toString ( ) ; Request request = new Request . RequestBuilder ( MethodType . GET , getMigrationAPIUrl ( oAuthMigrationRequest . getEnvironment ( ) ) ) . requiresAuthentication ( true ) . postJson ( requestjson ) . build ( ) ; Response response = client . makeJsonRequest ( request , oAuthMigrationRequest ) ; logger . debug ( "Response Code : " + response . getStatusCode ( ) ) ; if ( response . getStatusCode ( ) == 200 ) { ObjectReader reader = mapper . readerFor ( OAuthMigrationResponse . class ) ; OAuthMigrationResponse oAuthMigrationResponse = reader . readValue ( response . getContent ( ) ) ; return oAuthMigrationResponse ; } else { logger . debug ( "failed calling migrate API" ) ; throw new ConnectionException ( "failed calling migrate API" , response . getStatusCode ( ) + "" ) ; } } catch ( Exception ex ) { logger . error ( "Exception while calling migrate" , ex ) ; throw new ConnectionException ( ex . getMessage ( ) , ex ) ; } }
Calls the migrate API based on the the request provided and
returns an object with oauth2 tokens

@param environment
@return
@throws ConnectionException