Google authentication with email and password. - android

I am creating an application that uses google drive api, and requires authentication of a google account. The example on the quick start for using drive api for android uses google sign_in where user would be required to choose an account from the google accounts already added on the phone.
I dont want user to choose there own account. I want to add the account the api would be used in from code, such that files would be accessed from my own specified accounr not that of the user of the app. But I cant seam to find any sign_in or authentication form apart from the case when user is to choose an account.
Please can this be done? And if so how?

Answer would be simple No, you can do that but you have to use different API than that of Google's one. Google will ask to choose from account as it is added in implicit intent.

Related

Google Drive API : Do I need to submit declaration form for using OAuth 2.0 consent screen

I am implementing backup and restore feature to Google Drive in my App which is going to be publish in Play Store. By using Google Drive we need OAuth Consent screen.
I am confused about :
Do I need to submit declaration form to Google for using Google Drive to read/write files of my App.
If I need to submit form, Just for Backup and Restore feature would google allow my request.. Any Idea based on your experience.
Answer:
You will need to submit a declaration form for Play Store publication if you use one of the restricted scopes listed on the Permissions help article.
Accessing Google Drive doesn't require this method of verification, however depending on which scopes your application uses, you will need to have your app verified independently as per the OAuth API verification requirements (specifically if you use a restricted scope such as https://www.googleapis.com/auth/drive or https://www.googleapis.com/auth/drive.readonly.
Referenecs:
OAuth API verification FAQs - Google Cloud Platform Console Help
Declare permissions for your app - Play Console Help
Permissions - Play Console Help

How To add Gmail Account Credentials in Static way to Access that account in Android App

I am doing an android app which uses only my Google account. I want to integrate my Gmail Account in my Android app. So each user who uses my app can use my Google account only . I want to set my Google account in static without using AccountManager Obj to display all email in their Mobiles.
Please Help me.
You can't do this. Gmail account cannot be bind to multiple device (there is a limit ... i don't know exactly but i know it)
Google keep rights to disable those account, check in google account android policy.
You got to let people use their own google play account.

App-engine authenticating google account and google plus at the same time

I am working on a project based on google mobile backend starter. This is set up to authenticate users using their google account - https://cloud.google.com/developers/articles/mobile-backend-starter-api-reference/#secmod
I now want to get a users name and profile image as defaults for their profile. I have implemented the google plus APIs which gives me the information that I want - https://developers.google.com/+/mobile/android/people
Unfortunately at the moment I am asking the user to log in to the application with their google account and then asking them to log in again to get their google plus information. So my question is this: is there a way to modify the google plus login such that it takes the authentication from mobile backend starter rather than requiring a separate login?
This is a similar question Can I use Google Plus sign in to authenticate my OAuth methods in app engine? but I specifically want my standard sign in to authenticate the google plus (rather than the other way around) as very few people have an android phone without a google account but a larger percentage dont have a google plus account
If in your application you provide a "Sign-in with Google" functionality then you can upgrade that functionality with "Google SignIn Plus". Please refer to the document [1].Also go through the document[2], it gives you an idea how to use the Google+Sign In with your android application.
[1]Google SignIn Plus: https://developers.google.com/accounts/docs/OpenID#update-to-plus
[2]Google SignInfor Android: https://developers.google.com/+/mobile/android/sign-in

Login using Gmail credentials

Is there a way I can use Google credentials to get basic user info like
Email, Name, Gender
and use them in my application? Its like allowing user to login into my application using Gmail.
I asked the same here.
But the answer says:
You should not use Gmail for user authentication using Google
accounts. You can use Google + Sign-in for Android instead. This will
allow you to access the user's profile information upon getting the
required permissions using OAuth. Check out the guide here:
which i followed and everything worked fine.
But if a Gmail account has no GooglePlus profile, My application asks to create a GooglePlus account. Which makes me think I implemented a GooglePlus Login instead of Gmail Login.
Is the answer for my other question right? Meaning without a GooglePlus profile you cannot have a Gmail Login in Android?
If not how can I have a Google Login in my application?
A similar question here, with no replies.
Please help. Thank You
Try article on this Url : http://nilvec.com/implementing-smtp-or-imap-xoauth-authentication-in-java.html.
I think this will help you
I wouldn't confuse a "gmail" account and a "Google+" account as being different things. Really what you want is for a user to authenticate with their "Google account", which spans many services.
On Android, the easiest way to build authentication with Google accounts is to use the Google Play Services SDK, which includes services like Google sign in.
Google+ documents an end-to-end approach to using Google Play Services SDKs that cover the issues that you asked about by using the PlusClient:
Setting up the client
Getting the user's email address using either PlusClient.getAccountName() or the REST methods.
Getting the user's profile info using the PlusClient.loadPerson()
Documentation for using Google's OAuth2 to authenticate a user are provided at https://developers.google.com/accounts/docs/OAuth2Login. As the page notes, however, you and your users get additional features if they use a Google+ account and the Google+ Sign-in, but this is not necessary.
The scopes required are
https://www.googleapis.com/auth/userinfo.profile for name and gender
https://www.googleapis.com/auth/userinfo.email for the user's email address
Update: I should amend that these scopes are now deprecated, and scheduled for removal. See the URL above for details.

Can I use AccountManager to let users sign in with their Google account?

I'm creating an app that will need users to create an account. (Like Facebook or Twitter would require you to.)
BUT, since it's an Android app, should/can I let them sign in with their Google Account using AccountManager or some other service? It'd be very helpful if they could just sign in to their Google account and their settings and other options would be saved to that account.
Main questions summed up:
Is it possible to let a user just use their Google account in my app?
If so, do I use AccountManager to have them sign in and save account information/settings?
What are other options?
Yes, you can get users to log into their Google Services using their Google credentials, for example, I have an app on Google Tasks and I use the Android AccountManager to let users authenticate themselves using their Google account on the android device (No need for users to enter their password!)
There are some really good examples to get you started:
This is an in-depth look into how you can authenticate based on the users Android credentials, has an example of how things work and how the UI should be: http://www.finalconcept.com.au/article/view/android-account-manager-step-by-step-2
This is an example of getting AccountManager to work with a Google service like Google Tasks: https://developers.google.com/google-apps/tasks/oauth-and-tasks-on-android
The last example is using the same concept for accessing the Google Picasa service: http://code.google.com/p/google-api-java-client/wiki/AndroidAccountManager
The other options you have is to have users manually enter their username/password. For that you have to use a third party authentication API (like signpost for OAuth) for them to log in.
In my tasks/todo application I provide users both options to sign in, using their android credentials or using third party authentication for users that want to log in using some other account (an account which is not enabled on that device)
Let me know if you have more questions
Although it is a new development, Google Plus Sign-in introduced as part of Google Play Services can also be used. More info can be found at Android developers blog. See example implementation from Banjo app
There seems to be a big limitation - The user need to have Google+ app installed on the device to use this.
Also this is a pretty good blog if someone is interested in implementing the solution.
#Soham gave you some very useful links but he didn't correct one major error: AccountManager is the entity that manages the accounts on your Android device - it has nothing to do with your google account! you can use google account and create a NEW account on your device using the AccountManager.
The rest you can learn from the links Soham gave you.

Categories

Resources