23e40356eb | ||
---|---|---|
bin | ||
config | ||
docs | ||
grunttasks | ||
lib | ||
scripts | ||
test | ||
.dockerignore | ||
.env.dev | ||
.eslintrc | ||
.gitignore | ||
.nsprc | ||
.travis.yml | ||
AUTHORS | ||
CHANGELOG.md | ||
CONTRIBUTING.md | ||
Gruntfile.js | ||
LICENSE | ||
README.md | ||
Vagrantfile | ||
npm-shrinkwrap.json | ||
package.json |
README.md
Firefox Accounts Server
This project implements the core server-side API for Firefox Accounts. It provides account, device and encryption-key management for the Mozilla Cloud Services ecosystem.
Prerequisites
- node 4.5.0 or higher
- npm
- Grunt
Install
On some systems running the server as root will cause working directory permissions issues with node. It is recommended that you create a separate, standard user to ensure a clean and more secure installation.
Clone the git repository and install dependencies:
git clone git://github.com/mozilla/fxa-auth-server.git
cd fxa-auth-server
npm install
To start the server in dev memory store mode (ie. NODE_ENV=dev
), run:
npm start
This runs a script scripts/start-local.sh
as defined in package.json
. This will start up
4 services, three of which listen on the following ports (by default):
bin/key_server.js
on port 9000test/mail_helper.js
on port 9001./node_modules/fxa-customs-server/bin/customs_server.js
on port 7000bin/notifier.js
(no port)
When you Ctrl-c
your server, all 4 processes will be stopped.
To start the server in dev MySQL store mode (ie. NODE_ENV=dev
), run:
npm run start-mysql
Testing
Run tests with:
npm test
To select a specific glob of tests to run:
npm test -- test/local/account_routes.js test/local/password_*
- Note: stop the auth-server before running tests. Otherwise, they will fail with obscure errors.
Reference Client
https://github.com/mozilla/fxa-js-client
Dev Deployment
Refer to https://github.com/mozilla/fxa-dev.git.
Configuration
Configuration of this project
is managed by convict,
using the schema in
config/index.js
.
Default values from this schema can be overridden in two ways:
-
By setting individual environment variables, as indicated by the
env
property for each item in the schema.For example:
export CONTENT_SERVER_URL="http://your.content.server.org"
-
By specifying the path to a conforming JSON file, or a comma-separated list of paths, using the
CONFIG_FILES
environment variable. Files specified in this way are loaded when the server starts. If the server fails to start, it usually indicates that one of these JSON files does not conform to the schema; check the error message for more information.For example:
export CONFIG_FILES="~/fxa-content-server.json,~/fxa-db.json"
Troubleshooting
Firefox Accounts authorization is a complicated flow. You can get verbose logging by adjusting the log level in the config.json
on your deployed instance. Add a stanza like:
"log": {
"level": "trace"
}
Valid level
values (from least to most verbose logging) include: "fatal", "error", "warn", "info", "trace", "debug"
.
Database integration
This server depends on a database server
from the fxa-auth-db-mysql
repo.
When running the tests, it uses a memory-store
that mocks behaviour of the production MySQL server.
License
MPL 2.0