# Mounting Routes

The authentication routes must be mounted to your project. This gem includes a route helper for this purpose:

`mount_devise_token_auth_for` - similar to `devise_for`, this method is used to append the routes necessary for user authentication. This method accepts the following arguments:

| Argument     | Type   | Default      | Description                                                                                                                                                     |
| ------------ | ------ | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `class_name` | string | 'User'       | The name of the class to use for authentication. This class must include the [model concern described here](/devise-token-auth/usage/routes.md#model-concerns). |
| `options`    | object | {at: 'auth'} | The [routes to be used for authentication](/devise-token-auth/usage/routes.md#usage) will be prefixed by the path specified in the `at` param of this object.   |

**Example**:

```ruby
# config/routes.rb
mount_devise_token_auth_for 'User', at: 'auth'
```

Any model class can be used, but the class will need to include [`DeviseTokenAuth::Concerns::User`](/devise-token-auth/usage/model_concerns.md) for authentication to work properly.

You can mount this engine to any route that you like. `/auth` is used by default to conform with the defaults of the [ng-token-auth](https://github.com/lynndylanhurley/ng-token-auth) module and the [jToker](https://github.com/lynndylanhurley/j-toker) plugin.


---

# 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/usage/routes.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.
