You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The parameter `confirmSuccessUrl` is optional unless you are using the `confirmable` plugin from Devise in your `resource`'s model. If you have `confirmable` set up, you will have to provide it unless you have `config.default_confirm_success_url` set in `config/initializers/devise_token_auth.rb`.
The parameter `currentPassword` is optional if you have `config.check_current_password_before_update` set to false (disabled by default) or the `resource` model supports the `recoverable` Devise plugin and the `resource`'s `allow_password_change` attribute is set to true.
The parameter `currentPassword` is optional if you have `config.check_current_password_before_update` set to
263
+
false (disabled by default) on your generated `config/initializers/devise_token_aut.rb` or if the `resource`
264
+
model supports the `recoverable` Devise plugin and the `resource`'s `allow_password_change` attribute is set to true (this is done in the `userCheckPasswordToken` query when you click on the sent email's link).
The `UserResendConfirmationPayload` will return the `authenticatable` resource that was sent the confirmation instructions but also has a `message: String!` that can be used to notify a user what to do after the instructions were sent to them
@@ -232,16 +276,52 @@ requests using the `GET` method on the Rails side, but looks like there might be
232
276
on the [Apollo Client](https://www.apollographql.com/docs/apollo-server/v1/requests/#get-requests).
233
277
234
278
We will continue to build better docs for the gem after this first release, but in the mean time
235
-
you can use [our specs](https://github.com/graphql-devise/graphql_devise/tree/b5985036e01ea064e43e457b4f0c8516f172471c/spec/requests) to better understand how to use the gem.
236
-
Also, the [dummy app](https://github.com/graphql-devise/graphql_devise/tree/b5985036e01ea064e43e457b4f0c8516f172471c/spec/dummy) used in our specs will give you
279
+
you can use [our specs](spec/requests) to better understand how to use the gem.
280
+
Also, the [dummy app](spec/dummy) used in our specs will give you
237
281
a clear idea on how to configure the gem on your Rails application.
238
282
283
+
### More Configuration Options
284
+
As mentioned in the introduction there are many configurations that will change how this gem behaves. You can change
285
+
this values on the initializer files generated by the installer.
286
+
287
+
#### Devise Token Auth Initializer
288
+
The generated initializer file `config/initializers/devise_token_auth.rb` has all the available options documented
289
+
as comments. You can also use
290
+
**[DTA's docs](https://devise-token-auth.gitbook.io/devise-token-auth/config/initialization)** as a reference.
291
+
In this section the most important configurations will be highlighted.
292
+
293
+
-**change_headers_on_each_request:** This configurations defaults to `true`. This means that tokens will change on
294
+
each request you make, and the new values will be returned in the headers. So your client needs to handle this.
295
+
Setting this to `false` will allow you to store the credentials for as long as the token life_span permits. And
296
+
you can send the same credentials in each request.
297
+
-**batch_request_buffer_throttle:** When change_headers_on_each_request is set to true, you might still want your
298
+
credentials to be valid more than once as you might send parallel request. The duration you set here will
299
+
determine how long the same credentials work after the first request is received.
300
+
-**token_lifespan:** This configuration takes a duration and you can set it to a value like
301
+
`1.month`, `2.weeks`, `1.hour`, etc.
302
+
303
+
**Note:** Remember this gem adds a layer on top of DTA, so some configurations might not apply.
304
+
305
+
#### Devise Initializer
306
+
The generated initializer file `config/initializers/devise_token_auth.rb` has all the available options documented
307
+
as comments. You can also use
308
+
**[Devise's docs](https://github.com/heartcombo/devise)** as a reference.
309
+
In this section the most important configurations will be highlighted.
310
+
311
+
-**password_length:** You can change this value to validate password length on sign up and password update
312
+
(must enable the validatable module).
313
+
-**mailer_sender:** Set it to a string with the sender's email address like `'support@example.com'`.
314
+
-**case_insensitive_keys:** Setting a value like `[:email]` will make email field case insensitive on login, sign up, etc.
315
+
-**email_regexp:** You can customize the regex that will validate the format of email addresses (must enable the validatable module).
316
+
317
+
**Note:** Remember this gem adds a layer on top of Devise, so some configurations might not apply.
318
+
239
319
### Using Alongside Standard Devise
240
320
The DeviseTokenAuth gem allows experimental use of the standard Devise gem to be configured at the same time, for more
241
321
information you can check [this answer here](https://github.com/lynndylanhurley/devise_token_auth/blob/2a32f18ccce15638a74e72f6cfde5cf15a808d3f/docs/faq.md#can-i-use-this-gem-alongside-standard-devise).
242
322
243
-
This gem supports the same and should be easier to handle email templates due to the fact we don't override standard Devise
244
-
templates.
323
+
This gem supports the same and should be easier to handle email templates due to the fact we don't override
324
+
standard Devise templates.
245
325
246
326
## Future Work
247
327
We will continue to improve the gem and add better docs.
0 commit comments