Loop/OAuth Setup
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.
Contents
Step One: Get your Client ID and Key
- Go to https://console.developers.google.com/
- Click on "Create Project"
- Change the project name to something like "Loop" or "Hello"
- Accept TOS and click on "Create"
- On the left-hand menu, click on "APIs & Auth"
- In that same menu, click on "Credentials"
- Under "OAuth", click on "Create new Client ID"
- Select "Installed application"
- Leave "Installed Application Type" set to "Other", and click "Create Client ID"
- Note the Client ID and Client Secret
- Go to "Consent Screen"
- 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.