title: How can I make AccountManager handle multiple accounts per username?
body: <p>I would like to use Android's built-in AccountManager to handle accounts for our native Android app. However, we have a peculiar need.</p>
  
  <p>It appears that Android's concept of an Account is a combination of name (i.e. MazerRackham@example.com) and type (i.e. com.example). Name is the username you login with. Type is associated with your application or company.</p>
  
  <p>However, our REST backend allows a single user to have multiple accounts and each account must be accessed by its own unique hash tied to the combination of one username and one account number (in addition to type).</p>
  
  <p>I already have the AccountAuthenticator, AuthenticationService, and AccountAuthenticatorActivity working for a single user with a single account number and single stored hash. Is there any way in which I could implement my AccountAuthenticator to handle users with multiple accounts under the same username, each requiring a hash? Would it be possible to attach a delimiter to the username and split it into username and account number every time I use it?</p>
  
  <p>If I cannot figure out a way to handle this, how should I gracefully fall back during AbstractAccountAuthenticator.getAuthToken? Would it make sense to set the hash to a special flag value and use legacy login methods for that user? Or is that too much of a hack?</p>
  
  <p>Thanks for your help!</p>