登录Android应用程序与Gmail凭证 [英] Login in Android app with Gmail credentials

查看:452
本文介绍了登录Android应用程序与Gmail凭证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获得身份验证令牌如何使用它与谷歌的凭据登录后

After getting the auth Token how to use it to login with google credentials

 AccountManager am=AccountManager.get(this); 
 Account[] accounts= am.getAccountsByType("com.google");
 account=accounts[0];
 amf = am.getAuthToken(account,"com.google", true,  
        new AccountManagerCallback<Bundle>() {  
   public void run(AccountManagerFuture<Bundle> arg0) {  

                try {  
                    Bundle result;  
                    Intent i;  
                    String token;  

                    result = arg0.getResult();  
        if (result.containsKey(AccountManager.KEY_INTENT)) {  
                        i = (Intent)result.get(AccountManager.KEY_INTENT);  
                        System.out.println("INtect=="+i.toString());
                        if (i.toString().contains("GrantCredentialsPermissionActivity")) {  

                            cbt.startActivity(i);  
                            System.out.println("ssstttt");
                        } else {  
                            cbt.startActivity(i);
                            System.out.println("endddddd");
                        }  

                    } else {       
 token = (String)result.get(AccountManager.KEY_AUTHTOKEN);  

我已得到谷歌帐户生成的API密钥,但如果发送的authToken和API密钥,以便用户可以登录使用他的Gmail凭据

I have got the generated API key from google Account,but where to send the authToken and API key so that user can login using his gmail credentials

推荐答案

它不使用Gmail凭据建议,由于Google+和Gmail合并,你真正想要的,是能够通过Google+登录。这也将让你能够进行API调用。

It's not recommended using Gmail credentials, since Google+ and Gmail is merged, what you actually want, is to be able to login with Google+. This will also make you able to make API calls.

阅读更多实施的Google+登录,在您的应用程序这里

Read more implementing Google+ sign in, in your app here

这篇关于登录Android应用程序与Gmail凭证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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