谷歌openID登录集成

时间:2014-01-05 03:05:23

标签: android android-studio google-openid

我按照google oauth tutorial为我的应用实施openId登录。

我使用了https://www.google.com/accounts/o8/id,但有些网页视图没有在模拟器中显示Google登录页面。只显示空白页。

这是我的相关代码段。有什么输入吗?

Intent intent = new Intent(this, WebViewActivity.class);
                intent.setData(Uri.parse("https://www.google.com/accounts/o8/ud"));
                startActivityForResult(intent, 0);

WebViewActivity代码:

 protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Allow the title bar to show loading progress.
        requestWindowFeature(Window.FEATURE_PROGRESS);

        WebView webview = new WebView(this);
        setContentView(webview);

        // Load the page
        Intent intent = getIntent();
        if (intent.getData() != null) {
            webview.loadUrl(intent.getDataString());
        }
................
}

我的网络应用使用OpenId,因此OAuth不适用于我。

1 个答案:

答案 0 :(得分:1)

我做的与样本中提到的相同。

当我尝试打开你提到的https://www.google.com/accounts/o8/id

的网址时

我收到以下屏幕。

enter image description here

当我尝试使用网址https://www.google.com/accounts/o8/ud时,它会重定向到https://accounts.google.com/o/openid2/auth

并在我的网页浏览中提供以下屏幕

enter image description here

我认为url应该包含这些参数

https://accounts.google.com/o/oauth2/auth?  CLIENT_ID = 424911365001.apps.googleusercontent.com&安培;  RESPONSE_TYPE =代码&安培;  范围=的OpenID%20email&安培;  REDIRECT_URI = https://oa2cb.example.com/&  状态= security_token%3D138r5719ru3e1%26url%3Dhttps://oa2cb.example.com/myHome&  login_hint=jsmith@example.com&  openid.realm = example.com&安培;  HD = example.com

如此处所述https://developers.google.com/accounts/docs/OAuth2Login#sendauthrequest

屏幕需要一些时间才能显示,所以请稍等片刻查看我发布的输出。尝试时确保没有连接到任何受限制的WiFi网络。最好尝试任何2g或3g网络。

已更新

检查一次是否为Open Id

https://developers.google.com/accounts/docs/OpenID#settingup(请求第3点请求)

关于终点

https://developers.google.com/accounts/docs/OpenID#endpoint