private synchronized void fetchAccessToken() throws ConnectionException, HTTPException {
        if (accessToken != null) {
            return;
        }

        Map<String, String> params = new HashMap<>();
        params.put(Constants.PARAM_CLIENT_ID, clientId);
        params.put(Constants.PARAM_CLIENT_SECRET, clientSecret);

        if (isUserAuthFlow()) {
            params.put(Constants.PARAM_GRANT_TYPE, Constants.PARAM_PASSWORD);
            params.put(Constants.PARAM_USERNAME, username);
            params.put(Constants.PARAM_PASSWORD, password);

        } else {
            params.put(Constants.PARAM_GRANT_TYPE, Constants.GRANT_TYPE_CLIENT_CREDENTIALS);
        }

        loadAccessToken(params);
    }
private synchronized void fetchAccessToken ( ) throws ConnectionException , HTTPException { if ( accessToken != null ) { return ; } Map < String , String > params = new HashMap < > ( ) ; params . put ( Constants . PARAM_CLIENT_ID , clientId ) ; params . put ( Constants . PARAM_CLIENT_SECRET , clientSecret ) ; if ( isUserAuthFlow ( ) ) { params . put ( Constants . PARAM_GRANT_TYPE , Constants . PARAM_PASSWORD ) ; params . put ( Constants . PARAM_USERNAME , username ) ; params . put ( Constants . PARAM_PASSWORD , password ) ; } else { params . put ( Constants . PARAM_GRANT_TYPE , Constants . GRANT_TYPE_CLIENT_CREDENTIALS ) ; } loadAccessToken ( params ) ; }
/*
Fetch a new access token.