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
Copy file name to clipboardExpand all lines: docs-v3/content/auth/authentication.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ category: Auth
5
5
position: 1
6
6
---
7
7
8
-
Laravel Restify has the support for a facile authentication with [Laravel Sanctum](https://laravel.com/docs/sanctum#api-token-authentication).
8
+
Laravel Restify supports easy authentication with [Laravel Sanctum](https://laravel.com/docs/sanctum#api-token-authentication).
9
9
10
10
Now you can finally enjoy the auth setup (`register`, `login`, `forgot`, and `reset password`).
11
11
@@ -21,8 +21,8 @@ php artisan restify:setup-auth
21
21
22
22
This command will:
23
23
24
-
-**ensures** that `Sanctum` is installed and configured as the authentication provider in the `config/restify.php` file
25
-
-**appends** the `Route::restifyAuth();` line to the `routes/api.php` file to add the authentication routes
24
+
-**Ensures** that `Sanctum` is installed and configured as the authentication provider in the `config/restify.php` file
25
+
-**Appends** the `Route::restifyAuth();` line to the `routes/api.php` file to add the authentication routes
26
26
27
27
## Prerequisites
28
28
@@ -36,7 +36,7 @@ Laravel 10 automatically ships with Sanctum, so you don't have to install it.
36
36
37
37
### Install sanctum
38
38
39
-
See the docs[here](https://laravel.com/docs/sanctum#installation). You don't need to add `\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,`in your `'api'` middleware group.
39
+
See the documentation[here](https://laravel.com/docs/sanctum#installation). You don't need to add `\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,`to your `'api'` middleware group.
40
40
41
41
You only have to run these 3 commands:
42
42
@@ -88,7 +88,7 @@ Restify provides you a simple way to add all of your auth routes prepared. Simpl
88
88
Route::restifyAuth();
89
89
```
90
90
91
-
And voilà, now you have auth routes ready to be used.
91
+
And that's it! You now have authentication routes ready to use.
92
92
93
93
These are the default routes provided by restify:
94
94
@@ -113,7 +113,7 @@ You can also pass an `actions` argument, which is an array of actions you want t
By using the `actions` argument, only the specified routes will be registered. If no `actions` argument is passed, Restify will register all the routes by default.
116
+
When using the `actions` argument, only the specified routes will be registered. If no `actions` argument is provided, Restify will register all routes by default.
117
117
118
118
119
119
## Sanctum Middleware
@@ -160,7 +160,7 @@ curl -X POST "http://restify-app.test/api/login" \
160
160
}'
161
161
```
162
162
163
-
So you should see the response like this:
163
+
You should see a response like this:
164
164
165
165
```json
166
166
{
@@ -182,11 +182,11 @@ So you should see the response like this:
182
182
183
183
### Authorization
184
184
185
-
We will discuss the authorization in more details here [Authorization](/auth/authorization). But for now let's see a simple example.
185
+
We will discuss authorization in more detail in the [Authorization](/auth/authorization) section. For now, let's see a simple example.
186
186
187
187
After a successful login, you will receive an authentication token. You should include this token as a `Bearer` token in the Authorization header for your subsequent API requests using [Postman](https://learning.postman.com/docs/sending-requests/authorization/#bearer-token), axios library, or cURL.
188
188
189
-
Here's an axios example for retrieving the user's profile with the generated token:
189
+
Here's an Axios example for retrieving the user's profile with the generated token:
190
190
191
191
```js
192
192
importaxiosfrom'axios';
@@ -218,7 +218,7 @@ Replace `http://restify-app.test` with your actual domain and use the authentica
218
218
219
219
## Register
220
220
221
-
Let's see how to register a new user in the application. You can test the registration using Curl or Postman.
221
+
Let's see how to register a new user in the application. You can test the registration using cURL or Postman.
222
222
223
223
Use the following endpoint for registration:
224
224
@@ -237,7 +237,7 @@ And send this payload:
237
237
238
238
Note: Email and password fields are required.
239
239
240
-
Now, you can send a POST request with Curl:
240
+
Now, you can send a POST request with cURL:
241
241
242
242
```shell
243
243
curl -X POST "http://restify-app.test/api/register" \
@@ -299,7 +299,7 @@ MAIL_MAILER=log
299
299
300
300
This will log the email content to the `laravel.log` file, allowing you to see the password reset email without actually sending it.
301
301
302
-
Now, you can send a POST request with Curl:
302
+
Now, you can send a POST request with cURL:
303
303
304
304
```shell
305
305
curl -X POST "http://restify-app.test/api/forgotPassword" \
@@ -337,7 +337,7 @@ The payload should include the token and email received from the password reset
337
337
"password_confirmation": "new_password"
338
338
}
339
339
```
340
-
Now, you can send a POST request with Curl:
340
+
Now, you can send a POST request with cURL:
341
341
342
342
```shell
343
343
curl -X POST "http://restify-app.test/api/resetPassword" \
@@ -392,7 +392,7 @@ After running the command, the register controller will be published to your app
392
392
393
393
<alerttype="warning">
394
394
395
-
Important Note: If you want to publish other actions in the future, you'll need to manually update the `routes/api.php` file before running the restify:auth command again. Remove any previously published Restify routes, and keep the `Route::restifyAuth();` line so that the new routes can be correctly published.
395
+
**Important Note:** If you want to publish other actions in the future, you'll need to manually update the `routes/api.php` file before running the `restify:auth` command again. Remove any previously published Restify routes, and keep the `Route::restifyAuth();` line so that the new routes can be correctly published.
0 commit comments