Improve doc about JWT auth

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

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

Loading…
Cancel
Save