简体   繁体   中英

How do you obtain a oAuth2 token using webView in android?

How do you obtain a oAuth2 token using a webView in android? I know how to make a webview and open the url to obtain the oAuth2 token, but I dont know how to switch from the webView back to the app once its obtained, and copy the oAuth2 token into a variable, does anyone know how to do this or know of a good tut? ps I'm trying to obtain a oAuth2 token to access a google api

Maybe this might be late.
But this may help the people who face the similar problem.
I found this tutorial which is useful:
http://www.learn2crack.com/2014/01/android-oauth2-webview.html

Either set it in the title of the WebView window and get it via: http://developer.android.com/reference/android/webkit/WebView.html#getTitle ()

Or set a cookie in the WebView and grab it from the cookie. More info here (in section 3.2.2): https://sites.google.com/site/oauthgoog/oauth-practices/mobile-apps-for-complex-login-systems/samplecode

That documentation is geared towards authentication and not authorization/OAuth specifically, but the same underlying techniques still apply.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM