# Configuration

You will need to create a [user model](usage/model_concerns), [define routes](usage/routes), [include concerns](usage/controller_methods), and you may want to alter some of the [default settings](config/initialization) for this gem. Run the following command for an easy one-step installation:

```bash
rails g devise_token_auth:install [USER_CLASS] [MOUNT_PATH]
```

or for `Mongoid`

```bash
rails g devise_token_auth:install_mongoid [USER_CLASS] [MOUNT_PATH]
```

**Example**:

```bash
rails g devise_token_auth:install User auth
```

This generator accepts the following optional arguments:

| Argument    | Default | Description                                                               |
| ----------- | ------- | ------------------------------------------------------------------------- |
| USER\_CLASS | `User`  | The name of the class to use for user authentication.                     |
| MOUNT\_PATH | `auth`  | The path at which to mount the authentication routes. [Read more](usage). |

The following events will take place when using the install generator:

* An initializer will be created at `config/initializers/devise_token_auth.rb`. [Read more](config/initialization).
* A model will be created in the `app/models` directory. If the model already exists, a concern (and fields for `Mongoid`) will be included at the file. [Read more](usage/model_concerns).
* Routes will be appended to file at `config/routes.rb`. [Read more](usage/routes).
* A concern will be included by your application controller at `app/controllers/application_controller.rb`. [Read more](usage/controller_methods).
*   For `ActiveRecord` a migration file will be created in the `db/migrate` directory. Inspect the migrations file, add additional columns if necessary, and then run the migration:

    ```bash
    rake db:migrate
    ```

You may also need to configure the following items:

* **OmniAuth providers** when using 3rd party oauth2 authentication. [Read more](config/omniauth).
* **Cross Origin Request Settings** when using cross-domain clients. [Read more](config/cors).
* **Email** when using email registration. [Read more](broken-reference).
* **Multiple model support** may require additional steps. [Read more](usage/multiple_models).
