# 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).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devise-token-auth.gitbook.io/devise-token-auth/config.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
