When deling with access token OAuth 2.0 In a nutshell what's the difference from using:
AccountManager.getAuthToken ("oauth2:https...userinfo.profile")
,
and using Google Plays:
GoogleAuthUtil.getToken(mActivity, mEmail, mScope)
As I understand it they both produce a challenge screen for the user, the Google Plays screen is user friendlier. The access token can have same scope right?! Both call have to be asynchronously. InvalidateToken looks like it has to be checked for in both calls, and more?
I didn't know about using Google Play services for OAuth 2.0 authentication, but after taking a quick look at it, it looks pretty interesting and I think it's something I could prefer to use over the AccountManager.getAuthToken.
AccountManager.getAuthToken
Pro:
Con:
GoogleAuthUtil.getToken
Pro:
Con:
AccountManager.getAuthToken Challenge screen on Gingerbread and Ice Cream Sandwich
GoogleAuthUtil.getToken Challenge screen
Since the GoogleAuthUtil approach has a much user friendlier challenge screen and requires less permissions at install time I would definitely use this approach instead of the AccountManager.getAuthToken approach whenever I can. Since you always get a valid token and don't have to hassle with invalidating the token it should make the code simpler as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With