Does OkHttp have any issue with saving and restoring cookies automatically? I am facing the following issue:
I have a Reddit client app which was working correctly. I hadn't updated it in over a year but due to some change in Reddit API I am forced to do so now. The app is working fine using HttpUtils and old HttpClient implementation. But when I tried to do it with okHttp (and okHttpUtils2), it does not look like it is saving the user login cookie. For example, after login to Reddit with API (which works and returns the hash and other value correctly), I immediately call the Subscribed API to get a list of subreddits the user is subscribed to. In my old app, it is still returning the correct values in JSON. But in okHttp version it returns an empty {}. I suspect this is because the API cannot detect the logged in user as the Subscribed API relies entirely on cookie to do that.
I saw a post on Stackoverflow which I think is related to this. A solution is also mentioned. Could you please take a look?
http://stackoverflow.com/questions/25461792/persistent-cookie-store-using-okhttp-2-on-android
I am using the following:
I have a Reddit client app which was working correctly. I hadn't updated it in over a year but due to some change in Reddit API I am forced to do so now. The app is working fine using HttpUtils and old HttpClient implementation. But when I tried to do it with okHttp (and okHttpUtils2), it does not look like it is saving the user login cookie. For example, after login to Reddit with API (which works and returns the hash and other value correctly), I immediately call the Subscribed API to get a list of subreddits the user is subscribed to. In my old app, it is still returning the correct values in JSON. But in okHttp version it returns an empty {}. I suspect this is because the API cannot detect the logged in user as the Subscribed API relies entirely on cookie to do that.
I saw a post on Stackoverflow which I think is related to this. A solution is also mentioned. Could you please take a look?
http://stackoverflow.com/questions/25461792/persistent-cookie-store-using-okhttp-2-on-android
I am using the following:
- B4A 6.31
- okHttp 1.01
- OkHttpUtils2 2.20