For the simpler version, see https://github.com/mozilla/fxa-content-server/pull/283.