I am just trying to authenticate my login via google. The user must enter his ID and Password and I must validate the login in the app itself (with no web view). I have tried to figure this out myself but not able to :( .Can any suggest me where and how should I start? and what are the jar's I may need to download? Any help would be greatly appreciated.
1 Answer
Google Play Services was created and released recently for simplifying the process of OAuth for Google products. You might want to start here - Auth with Play Services
The user device should have the Play Services APK installed to get the full use out of this, but Google says most devices above Android 2.1 who used the Play Store should have these services on the device, ready to be used.
Also read the Setting up section to see how you need to set up your project and device to use these services.
5 Comments
Prajwal Udupa
@shakar96 thanks for the quick reply. Will this also authenticate email id's which are not associated with play store? like I have a different account for playstore and different for gmail usage. will my gmail id be authenticated via this process?
radhashankark
Yes, as long as the account is added on the device and authenticated at least once, you should be able to get an OAuth token for that account with the Play Services.
Prajwal Udupa
what if the account is not added on the device? this is my last question. sorry for bugging you. :)
radhashankark
Simple version, you might want to add the email you want to Auth to, to your device. Long version, Play Services was designed to pick out all Google accounts authenticated on the device and provide you with a simple way to get OAuth tokens to those accounts, without the user having to enter their credentials for your app. If you really want to use an account that is not on the device, your only bet is to use a browser/webView to ask the user for credentials and then follow the OAuth flow.
Etienne Lawlor
Hey @shankar96, this used to work for me, but only a few days ago it stopped working and now it throws this error com.google.android.gms.auth.GoogleAuthException: Unknown. Any idea why? Is there something wrong with my scopes? gist.github.com/lawloretienne/7351151