> For the complete documentation index, see [llms.txt](https://devise-token-auth.gitbook.io/devise-token-auth/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devise-token-auth.gitbook.io/devise-token-auth/config.md).

# Configuration

You will need to create a [user model](/devise-token-auth/usage/model_concerns.md), [define routes](/devise-token-auth/usage/routes.md), [include concerns](/devise-token-auth/usage/controller_methods.md), and you may want to alter some of the [default settings](/devise-token-auth/config/initialization.md) 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](/devise-token-auth/usage.md). |

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](/devise-token-auth/config/initialization.md).
* 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](/devise-token-auth/usage/model_concerns.md).
* Routes will be appended to file at `config/routes.rb`. [Read more](/devise-token-auth/usage/routes.md).
* A concern will be included by your application controller at `app/controllers/application_controller.rb`. [Read more](/devise-token-auth/usage/controller_methods.md).
* 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](/devise-token-auth/config/omniauth.md).
* **Cross Origin Request Settings** when using cross-domain clients. [Read more](/devise-token-auth/config/cors.md).
* **Email** when using email registration. [Read more](broken://pages/-L9vRAlAfMYpe9K_KCFc).
* **Multiple model support** may require additional steps. [Read more](/devise-token-auth/usage/multiple_models.md).
