Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

User Accounts and Authentication

autopulated edited this page Sep 12, 2014 · 8 revisions

##Authentication in Yotta Yotta requires users to be authenticated in two circumstances:

  1. When using yotta publish to publish a new version of a module to the yotta registry, yotta needs to ensure you have permission to publish the current module
  2. When pulling module dependencies that have been specified as github URLs, yotta asks you to authenticate with GitHub to get you a GitHub API access token that can be used to download modules (including modules in private repositories that you have access to).

In both cases yotta uses a third party OAuth2 provider to verify your identity, if you are attempting to publish then this can be any supported provider, but if you need to access modules from GitHub then you must log in with GitHub.

Yotta uses email addresses as users' identities – so we only recognise email addresses that trusted providers have verified by sending email.

Authenticating Actions

Pushing

If the user has any verified emails on their account that match any email addresses allowed to publish the package then permission is granted.

Github

Any valid github login that gives yotta permission, the yotta registry then forwards the access token to the requesting client.

##Example Scenarios We need to support (or provide error messages for) the following scenarios without unexpected behaviour:

Log in with mbed then GitHub on the same computer with the same email address

Any verified email on the github account must match any one of the emails from the mbed account. If it doesn't then this is the next case. Any other verified email addresses from the github account are added to the existing account.

Log in with mbed then Github (different email) on the same computer

An error is reported to the user in the browser, telling the user their existing email addresses, and explaining that the github account needs to share a verified email with their logged in account. (or they could logout).

Log in with mbed on N different computers

Each time you log in with an mbed account with the same primary email on a new computer, the new key that you've generated is added to the existing account with that primary email. If you log in on a new computer with an account that shares only secondary emails with a primary or secondary email of another account, then a new account is created.

Log in with mbed, then Github with the same email on a different computer

If the github account has the same primary email as any existing account, then the new key and github token and emails are added to the existing account. Otherwise a new account is created with the new key and new primary email.

Log in with Github, then mbed on the same computer with the same email address

Any verified email on the mbed account must match any one of the emails from the mbed account. If it doesn't then this is the next case. Any other verified email addresses from the github account are added to the existing account.

Log in with Github, then mbed on the same computer with different email addresses

An error is reported to the user in the browser, telling the user their existing email addresses, and explaining that the mbed account needs to share a verified email with their logged in account. (or they could logout).

Log in with Github, on N different computers

Each time you log in with a GitHub account with the same primary email on a new computer, the new key that you've generated is added to the existing account with that primary email. If you log in on a new computer with an account that shares only secondary emails with a primary or secondary email of another account, then a new account is created.

Log in with Github, then mbed with the same email on a different computer

If the mbed account has the same primary email as any existing account, then the new key and emails are added to the existing account. Otherwise a new account is created with the new key and new primary email.

Two users log in with mbed with different emails A and B, then both log into Github with emails A and B

Both users get emails A and B added to their existing different accounts, and get a github access token.

Behaviour Summary

When logging in on a new computer (new key), the primary email address needs to match an existing primary address for the accounts to be merged.

When logging in with an additional provider on the same computer (existing key), then any matching email address between the two accounts is sufficient for the tokens and verified emails provided by the new provider to be added to the existing account associated with the key being used.