Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Google signin for a user without Google Play Services?

Is there a way of implementing Google signin that does not require Google Play Services? I'm aware that the official docs says that you need GPS:

• https://developers.google.com/identity/sign-in/android/start-integrating

however I also found conflicting information here:

• Google Plus Login without Google Play Services

that says that using Google+ Api you can implement the login without the user having GPS. Which is true? Can you technically implement login without GPS or not? If you can it would be nice to use as a fallback for users who can't download GPS for whatever reason.

like image 506
Jon Avatar asked Oct 19 '22 20:10

Jon


1 Answers

You can use the Android Account Manager to get an access token (if the user has signed in with his/her Google Account on the phone):

  • https://developers.google.com/android/guides/http-auth

If that is not what you want, you can always sign a user in using pure OAuth2 through a WebView. Here are some resources to get you started:

  • http://blog.doityourselfandroid.com/2011/08/06/oauth-2-0-flow-android/
  • How do you obtain a oAuth2 token using webView in android?
  • android OAuth-2.0 google login for user info using webview

If you choose to use a webview you will have to handle access/refresh tokens manually, which might or might not be convenient for you.

Good Luck!

Edit: You mentioned G+ in your post, so here is some information on how to add G+ scopes to your request:

  • https://developers.google.com/+/web/api/rest/oauth

(Choose a scope that you need and include it in your request for access/refresh token)

like image 72
Erik Zivkovic Avatar answered Nov 15 '22 07:11

Erik Zivkovic