update doc

This commit is contained in:
Charles 2026-02-18 16:33:27 +01:00
parent b2bb9fc78b
commit e388999ff7
1 changed files with 26 additions and 2 deletions

View File

@ -39,10 +39,11 @@ The route should be as follows:
```php ```php
#[Route('/api/v1/project', name: 'api_project')] //ofc, this is an example, please THINK and change the name #[Route('/api/v1/project', name: 'api_project')] //ofc, this is an example, please THINK and change the name
``` ```
Keep the same structure for the project tree, create an Api folder in the controller, a V1 folder and then create your controller.
Here is a full example of a controller with the create method. Here is a full example of a controller with the create method.
```php ```php
<?php <?php
#[Route('/api/v1/project', name: 'api_project_')] #[Route('/api/v2/project', name: 'api_project_')]
#[IsGranted('ROLE_API_INTERNAL')] #[IsGranted('ROLE_API_INTERNAL')]
class ProjectApi extends AbstractController{ class ProjectApi extends AbstractController{
@ -85,7 +86,7 @@ class ProjectApi extends AbstractController{
``` ```
# Services # Services
So, now we are getting into the thick of it. We are just COOK 🍗. So, now we are getting into the thick of it. We are just COOK 🍗 ( a lot of bugs can come from here ).
We implement a new pretty service called SsoTokenHandler. This is used to get the token received from the portal request, and validate it. We implement a new pretty service called SsoTokenHandler. This is used to get the token received from the portal request, and validate it.
It is validaded by doing a call back to the SSO and asking if the token is valid. ( we create a new token for the SSO so it handles M2M) It is validaded by doing a call back to the SSO and asking if the token is valid. ( we create a new token for the SSO so it handles M2M)
```php ```php
@ -192,3 +193,26 @@ We should be good now ( I hope ). Open the portal, try your call and check if it
If it still doesn't work, start praying, because I have no idea what to do anymore, but it works on my side, so it should work on yours, if not, well, I don't know what to say. Good luck. If it still doesn't work, start praying, because I have no idea what to do anymore, but it works on my side, so it should work on yours, if not, well, I don't know what to say. Good luck.
Jokes aside, bugs often come from security problem, if the client returns a 401 error, it can be for multiple reasons and not necessarily because of the token but maybe because of the token validation. Jokes aside, bugs often come from security problem, if the client returns a 401 error, it can be for multiple reasons and not necessarily because of the token but maybe because of the token validation.
Another commun bug is mismatching of the data you send, so double check. GLHF ( you won't have fun, but good luck anyway ) Another commun bug is mismatching of the data you send, so double check. GLHF ( you won't have fun, but good luck anyway )
.
.
.
.
.
.
.
.
.
.
.
If you have a problem and that you copy pasted everything, check client controller, I've put the route as /api/v2 just cause I felt like it 🤷 ENJOY