OAuth3 / SPEC

The OAuth3 Specification
18 stars 0 forks source link

Handling multiple account ids (subjects `sub`) in a single token #6

Open coolaj86 opened 8 years ago

coolaj86 commented 8 years ago

This has been on my mind for... years and in consideration with how OIDC standardizes ID Tokens, I think this is how it should work:

An azp (browser app) will submit natural user credentials (passphrase, totp, sms otp, etc) to the iss (api server with private key) and receive comma-delimited subs (pairwise account ids) for itself as the aud (api server validating keys).

So:

As I've noted in a thousand code comments in a bit bucket somewhere: this is conceptually how Google, Facebook, and every other enterprise system that allows multiple accounts per credential work. Internally you can access all accounts, but externally you only access one account at a time.

I believe the one-token-per-account rule is a good rule and except in the case of initial login (which would otherwise require cookies to keep the state of the multiple accounts), it works well with the code we have already.