{"id":19531935,"url":"https://github.com/franmontiel/persistentcookiejar","last_synced_at":"2025-05-15T20:03:38.351Z","repository":{"id":50423367,"uuid":"51529396","full_name":"franmontiel/PersistentCookieJar","owner":"franmontiel","description":"A persistent CookieJar implementation for OkHttp 3 based on SharedPreferences.","archived":false,"fork":false,"pushed_at":"2022-08-18T12:20:34.000Z","size":92,"stargazers_count":1808,"open_issues_count":24,"forks_count":247,"subscribers_count":49,"default_branch":"master","last_synced_at":"2025-04-08T01:38:43.082Z","etag":null,"topics":["android","android-library","cookiejar","cookies","okhttp3"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/franmontiel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-11T16:48:19.000Z","updated_at":"2025-04-02T09:55:18.000Z","dependencies_parsed_at":"2022-08-27T21:53:06.966Z","dependency_job_id":null,"html_url":"https://github.com/franmontiel/PersistentCookieJar","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franmontiel%2FPersistentCookieJar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franmontiel%2FPersistentCookieJar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franmontiel%2FPersistentCookieJar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franmontiel%2FPersistentCookieJar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/franmontiel","download_url":"https://codeload.github.com/franmontiel/PersistentCookieJar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254414493,"owners_count":22067271,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-library","cookiejar","cookies","okhttp3"],"created_at":"2024-11-11T01:45:06.408Z","updated_at":"2025-05-15T20:03:37.387Z","avatar_url":"https://github.com/franmontiel.png","language":"Java","readme":"PersistentCookieJar for OkHttp 3\n===============================\nA persistent CookieJar implementation for OkHttp 3 based on SharedPreferences.\n\nIf you're looking for a OkHttp 2/HTTPUrlConnection persistent CookieStore it can be found at [this Gist](https://gist.github.com/franmontiel/ed12a2295566b7076161).\n\nDownload\n--------\nStep 1. Add the JitPack repository in your root build.gradle at the end of repositories:\n```groovy\nallprojects {\n    repositories {\n        ...\n        maven { url \"https://jitpack.io\" }\n    }\n}\n```\nStep 2. Add the dependency\n```groovy\ndependencies {\n    compile 'com.github.franmontiel:PersistentCookieJar:v1.0.1'\n}\n```\nUsage\n-----\nCreate an instance of `PersistentCookieJar` passing a `CookieCache` and a `CookiePersistor`:\n\n```java\nClearableCookieJar cookieJar =\n                new PersistentCookieJar(new SetCookieCache(), new SharedPrefsCookiePersistor(context));\n```\n\nThen just add the CookieJar when building your OkHttp client:\n\n```java\nOkHttpClient okHttpClient = new OkHttpClient.Builder()\n                .cookieJar(cookieJar)\n                .build();\n```\n\nFeatures\n--------\nThis is a really simple library but here are some of the things that it provides:\n* Possibility to clear the jar: `PersistentCookieJar` implements `ClearableCookieJar` interface that declares a `clear()` method for removing all cookies from the jar.\n\n* Possibility to clear session cookies: `PersistentCookieJar` implements `ClearableCookieJar` interface that declares a `clearSession()` method for removing session cookies from the jar.\n\n* Decoupled and extensible: `CookieCache` and `CookiePersistor` are interfaces so you can provide your own implementation for each one.\n    * `CookieCache` represents an in-memory cookie storage. `SetCookieCache` is the provided implementation that uses a Set to store the Cookies.\n    * `CookiePersistor` represents a persistent storage. `SharedPrefsCookiePersistor` is the provided implementation that uses a SharedPreferences to persist the Cookies.\n\n* Thread-safe: `PersistentCookieJar` public methods are synchronized so there is no need to worry about threading if you need to implement a `CookieCache` or a `CookiePersistor`.\n\nProGuard\n-------\nThe following configuration is only needed for version 0.9.2 and below:\n```\n-dontwarn com.franmontiel.persistentcookiejar.**\n-keep class com.franmontiel.persistentcookiejar.**\n\n-keepclassmembers class * implements java.io.Serializable {  \n    static final long serialVersionUID;  \n    private static final java.io.ObjectStreamField[] serialPersistentFields;  \n    !static !transient \u003cfields\u003e;  \n    private void writeObject(java.io.ObjectOutputStream);  \n    private void readObject(java.io.ObjectInputStream);  \n    java.lang.Object writeReplace();  \n    java.lang.Object readResolve();  \n}\n```\n\nLicense\n-------\n    Copyright 2016 Francisco José Montiel Navarro\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranmontiel%2Fpersistentcookiejar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffranmontiel%2Fpersistentcookiejar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranmontiel%2Fpersistentcookiejar/lists"}