如何为Android安装JOpenID?

时间:2012-09-09 16:20:11

标签: android openid google-api jopenid

我尝试为我的Android应用程序制作一个openid登录活动。

对此我使用JOpenID ..

我可以获得'端点'和'关联'。

但是.. 我迷惑了中止setReturnTo()和setRealm()方法

我尝试使用'http:// locahost'和'myip'(硬编码)

manager.setReturnTo("http://locahost");
manager.setRealm("http://*.locahost");

代码看起来像这样。

public void ib_signon(View v)
{
         OpenIdManager manager = new OpenIdManager();

         manager.setReturnTo("http://locahost");
         manager.setRealm("http://*.locahost");

         //gets endpoint
         Endpoint endpoint = manager.lookupEndpoint("Google");
         System.out.println("endpoint=="+endpoint);

         //gets association
         Association association = manager.lookupAssociation(endpoint);
         System.out.println("association=="+association);

         String autUrl = manager.getAuthenticationUrl(endpoint, association);
         System.out.println("Copy the authentication URL in browser:\n" + autUrl);

         //show login-dialog in an webview
         webView = new WebView(this);
         webView.loadUrl(autUrl);
         setContentView(webView);

         /*System.out.println("After successfully sign on in browser, enter the URL of address bar in browser:");
         String ret = readLine();
         HttpServletRequest request = createRequest(ret);
         Authentication authentication = manager.getAuthentication(request, association.getRawMacKey());
         System.out.println(authentication);
         System.out.println("Identity: " + authentication.getIdentity());
         */
         //Intent i = new Intent(this, contactsActivity.class);
         //startActivity(i);
}

在google-login-dialog(webview)中编写帐户数据后,

Google回复:

The page you requested is invalid.  

0 个答案:

没有答案