1

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

I have read the authentication document but, still, I am unable to get what's needed to login programmatically on Android.

I mean, which URL should I pass to perform the login activity?

1 Answer 1

4

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.

Example:

private class ExampleWebViewClient extends WebViewClient
{
        @Override
        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());
1
  • 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
    Commented Apr 17, 2013 at 17:02

You must log in to answer this question.

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