Android To Drupal Cookie Transfer
Can someone please enlighten me on how I might send Drupal login cookie information from my Android app back to my Drupal site? Below is the code I am using in my attempts: HttpRes
Solution 1:
I do not believe that the HttpClient manages cookies by default. So you need to set up a cookie store, bind it the HTTP Context, and then use the context in POSTs, like this
mHttpContext = newBasicHttpContext();
mCookieStore = newCookieStore();
mHttpContext.setAttribute(ClientContext.COOKIE_STORE, mCookieStore);
...
HttpResponseresponse= mHttpClient.execute(mRequest, mHttpContext);
Once that is in place any cookies that sent from the Drupal site on responses will be automatically included on subsequent requests.
If you are interested to see what cookies are held by the CookieStore you can always do
List<Cookie> cookies = mCookieStore.getCookies();
Post a Comment for "Android To Drupal Cookie Transfer"