Improve doc about JWT auth

pull/4190/head
Angel Fernando Quiroz Campos 4 years ago
parent d671bb3288
commit 97de6dbec5
  1. 33
      README.md

@ -189,27 +189,26 @@ Libraries
## JWT Authentication
* php bin/console lexik:jwt:generate-keypair
* Run
```shell
php bin/console lexik:jwt:generate-keypair
```
* In Apache setup Bearer with:
`SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1`
Get the token:
```apacheconf
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
```
curl -k -X POST -H "Content-Type: application/json" https://example.com/api/authentication_token -d '{"username":"admin","password":"admin"}'
* Get the token:
```shell
curl -k -X POST https://example.com/api/authentication_token \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"admin"}'
```
The response should return something like:
`{"token":"MyTokenABC"}`
Go to:
https://example.com/api
Click in "Authorize" and write
```json
{"token":"MyTokenABC"}
```
* Go to https://example.com/api
* Click in "Authorize" button and write the value
`Bearer MyTokenABC`
Then you can make queries using the JWT token.

Loading…
Cancel
Save