public List<App> getUserApps(long id) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
		cleanError();
		prepareToken();

		URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_APPS_FOR_USER_URL, Long.toString(id)));

		OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
		OAuthClient oAuthClient = new OAuthClient(httpClient);
		OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString())
			.buildHeaderMessage();

		Map<String, String> headers = getAuthorizedHeader();
		bearerRequest.setHeaders(headers);

		List<App> apps = new ArrayList<App>();
		App app = null;
		OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.GET, OneloginOAuthJSONResourceResponse.class);
		if (oAuthResponse.getResponseCode() == 200) {
			JSONObject[] dataArray = oAuthResponse.getDataArray();
			if (dataArray != null && dataArray.length > 0) {
				for (JSONObject data: dataArray) {
					app = new App(data);
					apps.add(app);
				}
			}
		} else {
			error = oAuthResponse.getError();
			errorDescription = oAuthResponse.getErrorDescription();
		}
		return apps;
	}
public List < App > getUserApps ( long id ) throws OAuthSystemException , OAuthProblemException , URISyntaxException { cleanError ( ) ; prepareToken ( ) ; URIBuilder url = new URIBuilder ( settings . getURL ( Constants . GET_APPS_FOR_USER_URL , Long . toString ( id ) ) ) ; OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient ( ) ; OAuthClient oAuthClient = new OAuthClient ( httpClient ) ; OAuthClientRequest bearerRequest = new OAuthBearerClientRequest ( url . toString ( ) ) . buildHeaderMessage ( ) ; Map < String , String > headers = getAuthorizedHeader ( ) ; bearerRequest . setHeaders ( headers ) ; List < App > apps = new ArrayList < App > ( ) ; App app = null ; OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient . resource ( bearerRequest , OAuth . HttpMethod . GET , OneloginOAuthJSONResourceResponse . class ) ; if ( oAuthResponse . getResponseCode ( ) == 200 ) { JSONObject [ ] dataArray = oAuthResponse . getDataArray ( ) ; if ( dataArray != null && dataArray . length > 0 ) { for ( JSONObject data : dataArray ) { app = new App ( data ) ; apps . add ( app ) ; } } } else { error = oAuthResponse . getError ( ) ; errorDescription = oAuthResponse . getErrorDescription ( ) ; } return apps ; }
Gets a list of apps accessible by a user, not including personal apps.

@param id
Id of the user

@return List of Apps

@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
@throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor

@see com.onelogin.sdk.model.App
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/users/get-apps-for-user">Get Apps for a User documentation</a>