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
-`user_class`: Model name in which `Devise` modules will be included. This uses a `find or create` strategy. Defaults to `User`.
87
86
-`mount_path`: Path in which the dedicated graphql schema for devise will be mounted. Defaults to `/graphql_auth`.
88
-
89
-
The option `mount` is available starting from `v0.12.0`. This option will allow you to mount the operations in your own schema instead of a dedicated one. When this option is provided `mount_path` param is not used.
87
+
-`--mount`: This options is available starting from `v0.12.0`, it allows you to mount the operations in your own schema instead of a dedicated one. When provided `mount_path` param is ignored.
90
88
91
89
#### Mounting the Schema in a Separate Route
92
90
@@ -109,12 +107,12 @@ Will do the following:
109
107
`Admin` could be any model name you are going to be using for authentication,
110
108
and `api/auth` could be any mount path you would like to use for auth.
111
109
112
-
##### Important
110
+
**Important**
113
111
- Remember that by default this gem mounts a completely separate GraphQL schema on a separate controller in the route provided by the `at` option in the `mount_graphql_devise_for` method in the `config/routes.rb` file. If no `at` option is provided, the route will be `/graphql_auth`.
114
-
- Avoid passing the `--mount` option or the gem will try to use an existing schema.
112
+
- Avoid passing the `--mount` option if you want to use a separate route and schema.
115
113
116
-
#### Mounting Operations in Your Own Schema (> v0.12.0)
117
-
To configure the gem to use your own GQL schema use the `--mount` option.
114
+
#### Mounting Operations in an Existing Schema (> v0.12.0)
115
+
To configure the gem to use an existing GQL schema use the `--mount` option.
118
116
For instance the executing:
119
117
120
118
```bash
@@ -130,8 +128,8 @@ Will do the following:
130
128
- Add `SchemaPlugin` to the specified schema.
131
129
132
130
133
-
##### Important
134
-
- When using the `--mount` option the `mount_path`params is ignored.
131
+
**Important**
132
+
- When using the `--mount` option the `mount_path`param is ignored.
135
133
- The generator will look for your schema under `app/graphql/` directory. We are expecting the name of the file is the same as the as the one passed in the mount option transformed with `underscore`. In the example, passing `MySchema`, will try to find the file `app/graphql/my_schema.rb`.
136
134
- You can actually mount a resource's auth schema in a separate route and in your app's schema at the same time, but that's probably not a common scenario.
137
135
@@ -176,10 +174,10 @@ The second argument of the `mount_graphql_devise` method is a hash of options wh
176
174
customize how the queries and mutations are mounted into the schema. For a list of available
177
175
options go [here](#available-mount-options)
178
176
179
-
### Mounting Operations Into Your Own Schema
177
+
### Mounting Operations In an Existing Schema
180
178
181
-
Starting with `v0.12.0` you can now mount the GQL operations provided by this gem into your
182
-
app's main schema.
179
+
Starting with `v0.12.0` you can mount the GQL operations provided by this gem into an
180
+
existing schema in you app.
183
181
184
182
```ruby
185
183
# app/graphql/dummy_schema.rb
@@ -353,10 +351,11 @@ to call a different update method on your resource,`update_with_email`.
353
351
When the resource is not reconfirmable or the email is not updated, this method behaves exactly
354
352
the same as ActiveRecord's `update`.
355
353
354
+
#### Current flow
356
355
`update_with_email` requires one additional attribute when email will change or an error
357
356
will be raised:
358
357
359
-
1.`confirmation_url`: The full url of your client application. The confirmation email will contain this url plus
358
+
-`confirmation_url`: The full url of your client application. The confirmation email will contain this url plus
360
359
a confirmation token. You need to call `confirmRegistrationWithToken` with the given token on
361
360
your client application.
362
361
@@ -374,12 +373,12 @@ user.update_with_email(
374
373
`update_with_email` requires two additional attributes when email will change or an error
375
374
will be raised:
376
375
377
-
1.`schema_url`: The full url where your GQL schema is mounted. You can get this value from the
376
+
-`schema_url`: The full url where your GQL schema is mounted. You can get this value from the
378
377
controller available in the context of your mutations and queries like this:
379
378
```ruby
380
379
context[:controller].full_url_without_params
381
380
```
382
-
1.`confirmation_success_url`: This the full url where you want users to be redirected after
381
+
-`confirmation_success_url`: This the full url where you want users to be redirected after
383
382
the email has changed successfully (usually a front-end url). This value is mandatory
384
383
unless you have set `default_confirm_success_url` in your devise_token_auth initializer.
385
384
@@ -459,7 +458,7 @@ schema. Configure the plugin as explained [here](#mounting-operations-into-your-
459
458
so this can work.
460
459
461
460
##### Authentication Options
462
-
Wether you setup authentications as a default in the plugin, or you do it at the field level,
461
+
Whether you setup authentications as a default in the plugin, or you do it at the field level,
463
462
these are the options you can use:
464
463
1.**Any truthy value:** If `current_resource` is not `.present?`, query will return an authentication error.
465
464
1.**A callable object:** Provided object will be called with `current_resource` as the only argument if `current_resource` is `.present?`. If return value of the callable object is false, query will return an authentication error.
@@ -501,7 +500,7 @@ end
501
500
The install generator can include the concern in you application controller.
502
501
If authentication fails for a request, execution will halt and a REST error will be returned since the request never reaches your GQL schema.
503
502
504
-
#### Authenticate in Your GQL Schema (Deprecated)
503
+
#### Authenticate in an Existing Schema (Deprecated)
505
504
For this you will need to add the `GraphqlDevise::SchemaPlugin` to your schema as described
@@ -537,7 +536,7 @@ schema. Configure the plugin as explained [here](#mounting-operations-into-your-
537
536
so this can work.
538
537
539
538
##### Authentication Options
540
-
Wether you setup authentications as a default in the plugin, or you do it at the field level,
539
+
Whether you setup authentications as a default in the plugin, or you do it at the field level,
541
540
these are the options you can use:
542
541
1.**Any truthy value:** If `current_resource` is not `.present?`, query will return an authentication error.
543
542
1.**A callable object:** Provided object will be called with `current_resource` as the only argument if `current_resource` is `.present?`. If return value of the callable object is false, query will return an authentication error.
0 commit comments