Code example for CookieManager

Methods: setCookiePolicy

0
    private static final String URL_PREFIX = "https://www.inflatablegoldfish.com/sociallocate/api.php?";
     
    public static final int UPDATES_PER_HOUR = 60;
     
    public SocialLocate() { 
        CookieManager manager = new CookieManager();
        manager.setCookiePolicy(CookiePolicy.ACCEPT_ORIGINAL_SERVER);
        CookieHandler.setDefault(manager);
    } 
     
    public RequestResult<Void> auth(String accessToken) {
        String url = URL_PREFIX + "action=auth"
                + "&access_token=" + accessToken;
 
        try { 
            String response = Util.getURL(url, true);
             
            JSONObject jsonObject = new JSONObject(response);
             
            if (jsonObject.getInt("auth_status") == 0) {