Loop/OAuth Setup

From MozillaWiki
Jump to: navigation, search

One feature of the Loop / Hello service is the ability to import contacts from external sources.

For Google contacts, user authentication for this feature is achieved by using OAuth. In order to use Google's servers with OAuth, clients need to send an OAuth client ID and a secret during the OAuth procedure. Mozilla has such a key that ships as part of official Firefox builds; however, this key is not available to developers or downstream distributions. In order to make use of the Google contact import feature, non-official builds must provision their own key.

Note that this information is only useful if you're a developer building your own copy of Firefox. Typical users should not need to worry about OAuth keys.

Step One: Get your Client ID and Key

  1. Go to https://console.developers.google.com/
  2. Click on "Create Project"
  3. Change the project name to something like "Loop" or "Hello"
  4. Accept TOS and click on "Create"
  5. On the left-hand menu, click on "APIs & Auth"
  6. In that same menu, click on "Credentials"
  7. Under "OAuth", click on "Create new Client ID"
  8. Select "Installed application"
  9. Leave "Installed Application Type" set to "Other", and click "Create Client ID"
  10. Note the Client ID and Client Secret
  11. Go to "Consent Screen"
  12. You must add a "Product Name" or the OAuth will not work. You may fill out the other fields.
    • Note that the email address on the "Consent Screen" form will be visible to users. If you wish to use an email address other than the one you created the project with, then you must add a new member to the project, where the new user is identified by the email address you want to have visible to the users.

Step Two: Put your Client ID and Key in the Browser

There are two ways you can put this client ID and secret into Firefox. Long-term, it is easiest to include it at build time. If you wish to test your key before building it in, you may do so by setting preferences instead.

Option A: Building the Key In

First, on the machine you're using to build Firefox, create a one-line text file, containing the Client ID and the Client secret, separated by a single space. For example:

792156382162-oFT1WFf3sAyKdD7fRh1zF1gIfk0RF8Se.apps.googleusercontent.com zP0o6lJR2e0MoD_eenHYBT4

Then, in your .mozconfig file, add an autoconfig "--with-google-oauth-api-keyfile" option pointing to this file, using a full path. For example:

 ac_add_options --with-google-oauth-api-keyfile=/Users/Adam/devel/mozilla/google-oauth-api.key

If you already have a build of Firefox, you'll need to clobber it and rebuild it to ensure that the OAuth client information is picked up.

Option B: Setting Prefs

As an alternative, you may go to about:config and set the following prefs (adding them as "string" type if they are not already present):

  • loop.oauth.google.clientIdOverride
  • loop.oauth.google.clientSecretOverride

Note that these prefs will override any built-in values, even for official builds; so, if you'd like, you can use them to double-check that the Client ID and Client Secret are working before you build them into a binary.