Skip to content

Commit bff3370

Browse files
author
Benjamin RICHARD
committed
add extra info for GraphiQL + secured resource: how to query with graphiql
1 parent cffa911 commit bff3370

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,12 @@ from ApiPlatform.
270270
In /api you can test the API with the swagger interface. Because the route uses JWT token you have to call the /demo/security/login/jwt/tokens route with HTTP POST and Basic Auth. Login is test_php or test_js and password is test !
271271
Then in the swagger interface click on the upper right button Authorization and add 'Bearer THETOKENRECEIVED'
272272

273+
To get a valid JWT token you could use the login jwt route: /demo/login/jwt/frontend
274+
But, because i'm cool ;-) i made a command that will provide you the token. So just do `php bin/console app:new-jwt-token` and it will return a token.
275+
You can also provide a username/password to the command, i let you read the help of the command to know how-to do.
276+
277+
When using GraphiQL with secured resources, you won't be able to provide any token (i didn't find any clue for this). So i found this good tool to query my API by providing required Authorization header: [https://altair.sirmuel.design/](https://altair.sirmuel.design/).
278+
273279
### Sort
274280

275281
If you want to allow sorting based on columns, you will have to add Filter annotations on Entity. Look at the [Book entity and its ApiFilter](https://github.com/Rebolon/php-sf-flex-webpack-encore-vuejs/blob/38d98658b5e9c2848fe6ad0187c24650225be508/src/Entity/Library/Book.php#L27) which allow to sort on id and title.
@@ -579,6 +585,7 @@ I wrote some articles on medium to explain some practices setup in this project:
579585
* https://testcafe-discuss.devexpress.com/t/role-sometime-it-doesnt-seem-to-be-played/875
580586
* https://testcafe-discuss.devexpress.com/t/it-doesnt-run-all-tests-files/1230/2
581587
* https://testcafe-discuss.devexpress.com/t/object-domexceptio-error-when-running-tests/1231
588+
* https://stackoverflow.com/questions/51042516/how-to-use-graphiql-when-route-are-secured
582589

583590

584591
## License

0 commit comments

Comments
 (0)