File tree 1 file changed +13
-4
lines changed
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -63,13 +63,13 @@ The user needs to be logged in. Programmatically it looks like this.
63
63
Auth::setUser($user);
64
64
```
65
65
66
- And not the package will create ApiKeys for the Authorized user.
66
+ Now the package will create ApiKeys for the authorized user.
67
67
``` php
68
68
LaravelApiKeys::create(LaravelApiKeyType::PRODUCTION); // default is SANDBOX
69
69
```
70
70
71
71
## Using the your API Keys
72
- Change config/auth.php
72
+ Change the guards section of config/auth.php
73
73
``` php
74
74
'guards' => [
75
75
'web' => [
@@ -94,7 +94,7 @@ Route::middleware('auth:lak')->get('/user', function (Request $request) {
94
94
});
95
95
```
96
96
97
- Check your work from the command line .
97
+ Replace the x-api-key header with your own key and test it .
98
98
``` bash
99
99
100
100
$ curl -X GET \
@@ -103,7 +103,16 @@ $ curl -X GET \
103
103
-H ' x-api-key: al4PA8V5jSuq4oFJOxK6lS4CeZEkDFtayBObJTHJ'
104
104
105
105
```
106
-
106
+ The above curl command will return the user authorized by the ApiKey.
107
+ ``` json
108
+ {
109
+ "id" : 1 ,
110
+ "name" : " Ed Anisko" ,
111
+ "email" : " ed@nrml.co" ,
112
+ "created_at" : " 2019-10-17 07:18:59" ,
113
+ "updated_at" : " 2019-10-17 07:18:59"
114
+ }
115
+ ```
107
116
### Testing
108
117
109
118
``` bash
You can’t perform that action at this time.
0 commit comments