public static CompleteAuthenticationResult completeGitHubAuth(SlAppSettings appSettings, String clientId, String clientSecret, String code) { final HashMap<String, String> map = new HashMap<>(); map.put("client_id", clientId); map.put("client_secret", clientSecret); map.put("code", code); CompleteAuthenticationResult ret = new CompleteAuthenticationResult(); HashMap<String, String> postResult = NetworkUtils.getDataMap( NetworkUtils.performCall(GITHUB_COMPLETE_AUTH_URL, NetworkUtils.POST, map) ); if (postResult.containsKey("error")) { ret.message = postResult.get("error_description"); } else { ret.token = postResult.get("access_token"); ret.grantedScopes = postResult.get("scope"); appSettings.setGitHubAccess(ret.token, ret.grantedScopes); if (appSettings.hasGitHubAuthorization()) { ret.ok = true; } } return ret; } }