Skip to content

Commit 2f978fe

Browse files
committed
JWT Auth!
1 parent 1fd9e48 commit 2f978fe

2 files changed

Lines changed: 21 additions & 8 deletions

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,17 @@ bin/cake server -p 8765
2121
```
2222

2323
Then visit `http://localhost:8765` to see the welcome page.
24+
25+
## Crate a user & token
26+
27+
#### user
28+
29+
```bash
30+
bin/cake users add_superadmin -e email@email.com -p password
31+
```
32+
33+
#### token
34+
35+
```bash
36+
bin/cake tu_token superadmin
37+
```

config/users.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@
138138
'skipTwoFactorVerify' => true,
139139
'sessionKey' => 'Auth',
140140
],
141+
'JWT' => [
142+
'className' => 'Authentication.Jwt',
143+
'returnPayload' => false
144+
],
141145
'Form' => [
142146
'className' => 'CakeDC/Auth.Form',
143147
'fields' => [
@@ -169,14 +173,9 @@
169173
'className' => 'CakeDC/Users.Social',
170174
'authFinder' => false
171175
],
172-
'Token' => [
173-
'className' => 'Authentication.Token',
174-
'tokenField' => 'api_token',
175-
'resolver' => [
176-
'className' => 'Authentication.Orm',
177-
'finder' => 'active'
178-
],
179-
]
176+
'JWT' => [
177+
'className' => 'Authentication.JwtSubject'
178+
],
180179
],
181180
"Authorization" => [
182181
'enable' => true,

0 commit comments

Comments
 (0)