> An Android app I am building requires web authentication for users to make
> data calls. In Adobe AIR and later the iPhone, we did this by rendering a
> login page in a webview-equivalent page and setting a cookie when the user
> signs in. Subsequent data calls use the same Cookie Jar and so are seen as
> authenticated.
>
> In the Android version, I authenticate the user using a WebView and then
> once thats done, I make a data call using DefaultHttpClient, however I cant
> seem to load the data on the second call.
>
> Is there some cookie gotcha I am missing? I imagine the HTTPClient and
> WebView would share the same Cookie space. Am I wrong?

Did you get this working? I also want to retrieve an authentication
cookie from a webview that has logged in the user, but the
CookieManager doesn't return this new cookie. It only returns the
JSESSIONID cookie which was present already when making the request.

//Called from webview via javascript
public void loginSuccess() {
            final WebView wv =
(WebView)findViewById(R.id.webview);
            CookieSyncManager.getInstance().startSync();
            String cookies =
CookieManager.getInstance().getCookie(url);
            Log.d("MyApp", "Got cookies from html page: " + cookies);

        }

-Christer

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to