cmcnulty
cmcnulty

Reputation: 411

When to use account authenticator

I'm curious as to why some apps use the Authenticator components (eg. Github, Twitter, Yahoo) and other apps don't (eg. Amazon, FourSquare, PayPal). Has anyone done analysis on what the downside of using the AccountManager classes? If you chose not to implement an AccountAuthenticator why did you make that decision?

Are there best practices regarding when one should plug into the AccountManager vs handling your own authentication/sessions?

Upvotes: 2

Views: 238

Answers (1)

Jeff Brateman
Jeff Brateman

Reputation: 3277

Pros:

  1. Centralized token management for your whole app.
  2. Supposedly it can be used for cross-app tokens too.

Cons:

  1. Android's account manager APIs and documentation are quite lacking, and nobody really uses them the same way.
  2. The AccountAuthenticator APIs are broken for a certain use case in KitKat.
  3. Android will cache your tokens, even if you want to defer token validation to the AccountAuthenticator.

I would recommend that developers just use the AccountManager for UI practicality (adding/removing accounts), but not for actual token management. Manage your tokens within your own app utility classes.

Note: The PayPal app in the Samsung app store now uses AccountManager.

Upvotes: 2

Related Questions