Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I think my questions is not a duplicate of this one How to login programmatically

I have read the authentication document but still i am not able to get what should I do for if I want to perform login activity programmatically using Android code. I mean which url should I pass to perform login activity ?

share|improve this question
up vote 3 down vote accepted

Use implicit OAuth flow. Load the specified URL with necessary query parameters into a webview and when authentication is done you can get the access_token from the redirect_uri. You can have the webview handle the redirect_uri by setting a custom webview client.


private class ExampleWebViewClient extends WebViewClient
        public boolean shouldOverrideUrlLoading(WebView view, String url)

            if (url.startsWith(MY_REDIRECT_URI))
                //parse the URL here to get the access_token
                return true;

            return false;

And while initializing the webview, do

webview.setWebViewClient(new ExampleWebViewClient());
share|improve this answer
ok, so for login i must use webview only ? there is no method like a webservice. In case of above webview what could be a URL, can yo u give me a sample url please ? – Raynold Apr 17 '13 at 17:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .