-
Notifications
You must be signed in to change notification settings - Fork 208
Command Line Interface
Once you've installed the oauthd npm package globally, you will have the oauthd
command available.
This command allows you to create new oauthd instances, start them, and manage their plugins.
The CLI contains the following commands:
$ oauthd init # Initializes an instance
$ oauthd start # Starts an instance
$ oauthd plugins <command> [args] # Allows you to manage the instance's plugins
You can also get help about these commands by adding the --help
option to any
of them.
An oauthd instance is composed of the oauthd core, and a set of plugins.
Each plugin brings its own layer of features. oauthd is infinitely extendable.
To create your first oauthd instance, just run the following command:
$ oauthd init
This will launch a prompt that will guide you in the instance creation. The first thing you need to tell the prompt is the name of the instance:
oauthd> What will be the name of your oauthd instance?> myinstance
If the folder already exists, the prompt will ask your permission to overwrite it.
Then the prompt will ask you if you want to install the default plugins. There are 4 default plugins:
- The administrator auth plugin, which allows you to login to oauthd with a single admin account
- The request plugin, which allows you to perform API requests with oauthd
- The /me feature plugin, which extends the request plugin to retrieve a user's information
- The default front plugin, which contains a backoffice to manage your apps and configure your other plugins
oauthd> Do you want to install default plugins? (Y|n)> (Y)
If you answer 'Y', the default plugins will automatically be cloned from their git repository, and activated.
The command will also automaticall run npm install && grunt
in your instance's
folder.
Once all is done, you can go in your folder, and start the instance.
To start the instance, just run the following command:
$ cd myinstance && oauthd start
You should see something like this:
Initializing plugins engine
Loading 'auth'.
Loading 'request'.
Loading 'slashme'.
Loading 'front'.
oauthd start server
Error in angellist.json: { [Error: No such provider: angellist] message: 'No such provider: angellist', body: {} } skipping this provider
Error in openbankproject.json: { [Error: No such provider: openbankproject] message: 'No such provider: openbankproject', body: {} } skipping this provider
oauthd listening at http://0.0.0.0:6284 for http://localhost:6284
Server is ready (load time: 1.12s) Mon, 13 Oct 2014 13:08:14 GMT
Please note that you can modify the server's configuration by overriding the properties of the
config.js
in a config.local.js
file. Please see the Configuration section of this
wiki to get more information.
Once the instance server is started, you can access the web interface to create your first app and configure its API providers. To learn more about this, please follow this link.
create
$ oauthd plugins create <plugin_name>
This command creates a new plugin in the plugins
folder with a basic structure,
inits a git repository, and lets you develop and extend oauthd.
Available options
-
--force
: Creates the plugin and overrides any plugin with the same name -
--inactive
: Creates the plugin but does not add an entry in theplugins.json
file.
list
$ oauthd plugins list
This commands lists the plugins of your instance. These plugins can either be activated or deactivated.
You should see something like this if you only installed the default plugins
during the oauthd init
step:
This instance has 4 installed plugin(s):
4 active plugin(s)
- auth
- request
- slashme
- front
0 inactive plugin(s)
The activated plugins are listed in the plugins.json
file. You can deactivate
a plugin by just removing a line in this file.
A deactivated plugin is not loaded when you start the server, and just resides
in the plugins directory.
install
$ oauthd plugins install [repository]
To install a plugin from its git repository, just run the command like this:
$ oauthd plugins install https://plugin/git/repo#tag-or-branch
To install all the plugins listed in the plugins.json
file, just run the following
command:
$ oauthd plugins install
Available options
-
--force
: Installs the plugin, overwriting any folder inplugins/
with the same name.
uninstall
$ oauthd plugins uninstall <plugin_name>
This command uninstalls a plugin by removing its folder from the plugins
directory
and removing its entry from the plugins.json
file.
deactivate
$ oauthd plugins deactivate <plugin_name>
This command deactivates a plugin by removing its entry in the plugins.json
file.
Once a plugin is deactivated, it remains in the plugins folder, but is not loaded
when the server is launched.
activate
$ oauthd plugins activate <plugin_name>
This command reactivates a plugin by adding an entry in the plugins.json
file.