Listening for JSON data after authenticating (OAuth) through an Intent

I have an app that i am writing that requires a user to authenticate through OAuth, and then returns some JSON with a Secret key etc. I am achieving this through a browser Intent, and the information is returning to the browser but not the application. There are multiple stages to the authentication inside the browser, with the user inputting their email and password twice before the JSON is returned.

My question is this - is there anyway to set up a listener for that Intent that returns the data from the Intent when the browser finally loads the JSON response page?

Thanks in advance.

Answers


If you mean by saying "browser" an Android system browser, then answer is no. You should use Webview for this task.


Edit:

OAuth process had to be done like this:

  • Open webview for user to login.
  • Set onPageStarted listener to handle specific url after user login. In that response you can get token.

    webview.setWebViewClient(new WebViewClient() {
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            //get token here. Most often token is added to url
    });
    
  • After you have token, make separate request with HttpURLConnection or any other connection.

If you actually must do everything in WebView and want to get page content look at this thread


Need Your Help

Clearing a char (?) to create several filenames in C++

c++

Foreword: Hello. I've read several questions/answers and spent an hour trying to debug my code but to no avail, so here goes.

"An attempt was made to access a socket in a way forbidden by its access permissions" while using SMTP

c# asp.net sockets email smtp

I am trying to send mail c# when certain values in database crosses its threshold value.