Logging in to an Android app with Gmail credentials

After receiving Auten authentication, 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);  

I have a generated API key from a Google account, but where to send the authToken key and API so that the user can log in using their gmail credentials

+5
source share
1 answer

It is not recommended to use Gmail credentials, as Google+ and Gmail are combined, what you really want is the ability to log in to Google+. It will also allow you to make API calls.

Learn more about implementing Google+ in your app here.

0
source

All Articles