你如何获得的oauth2使用web视图在android系统令牌? [英] How do you obtain a oAuth2 token using webView in android?

查看:109
本文介绍了你如何获得的oauth2使用web视图在android系统令牌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何获得的OAuth2令牌使用android系统中网页视图?我知道如何使网页视图,并打开URL获得的OAuth2令牌,但我不知道如何从web视图切换到应用程序,一旦其获得和的OAuth2令牌复制到一个变量,没有人知道该怎么做这个或知道一个良好的啧啧?附:我想获得的OAuth2令牌来访问谷歌API

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? p.s. I'm trying to obtain a oAuth2 token to access a google api

推荐答案

将它设置在web视图窗口的标题,并通过获得它:
http://developer.android.com/reference/android/webkit/WebView html的#的getTitle ()

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

或设置web视图的cookie和cookie的抓住它。这里(第3.2.2节)更多信息:
<一href=\"https://sites.google.com/site/oauthgoog/oauth-practices/mobile-apps-for-complex-login-systems/sample$c$c\" rel=\"nofollow\">https://sites.google.com/site/oauthgoog/oauth-practices/mobile-apps-for-complex-login-systems/sample$c$c

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

这文档对身份验证和授权不/ OAuth的面向具体地说,但相同的底层技术仍然适用。

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

这篇关于你如何获得的oauth2使用web视图在android系统令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆