简体   繁体   中英

Google plus sign in on android

I've been searching web for a few days, and I am totally confused. I would like to add "Sign In with Google+" button to my android app. All I need from user is his name, email (if possible) and ID. Google suggests to use it's library, but I believe that it is to heavy solution for my purposes. I know that I should use OAuth, but I don't know what API I should use. Can someone point me where should I start?

You can take a look at OAuth.io and its Android SDK . It's easy and support more than 90 providers (Google plus included).

There is this blog article on how to authorize your user on Google Plus in javascript. The usage in android is similar and you have some sample code using Facebook and Twitter in the "example" directory of the Android SDK.

Actually I do recommend to use Google's own client, this would be GoogleAPIClient .

Here is the why. This client is fully optimise to run in Android, it is not actually as heavy as it looks and provide all necessary interfaces needed not just to authenticate your client to Google and handle connections, but can also be used to make request to any Google API service. Using third party tools is OK, but I recommend to do at least the authentication with the GoogleAPIClient and then retrieve the authentication token so it can be used in any other client. That last part can be done with GoogleAuthTool .

Another thing is the documentation, it seems to me that at least for the authentication part GoogleAPIClient for android is well documented at least for making a fair simple example and understand how it works.

Finally, why does it have a better performance? Third party tools in any platform will most likely use Google APIs and libraries to complete authentication, so they are building over it (like the google oauth2 omniauth extension in Ruby ), so using third party tools isn't exactly becoming more "lightweight"

The steps to authenticate with android are here

I hope this helps, best

Recently the source code of Google I/O 2013 app was released. The app has integration with Google+ sign in. You could download the source code and analyze how they are doing.

Here's the link to the announcement post, and to the app itself: http://code.google.com/p/iosched/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM