From a2823e101a772e2138ee3cdda824499f67990e0b Mon Sep 17 00:00:00 2001 From: Beu Date: Thu, 16 Feb 2023 15:12:11 +0100 Subject: [PATCH] Add config to the Readme --- README.md | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 194a21f..eac3351 100644 --- a/README.md +++ b/README.md @@ -37,4 +37,38 @@ php bin/console make:user Note that you have to answer **no** to the question `Does this app need to hash/check user passwords?` -Then, you could copy the files `TrackMania.php` in `src/Controller/OAuth2/` and `TrackManiaAuthenticator.php` in `src/Security/` \ No newline at end of file +Then, you could copy the files `TrackMania.php` in `src/Controller/OAuth2/` and `TrackManiaAuthenticator.php` in `src/Security/` + +Then change the `config/packages/knpu_oauth2_client.yaml` file like this: + +```yaml +knpu_oauth2_client: + clients: + TrackMania: + type: generic + provider_class: \Beu\TrackMania\OAuth2\Client\Provider\TrackManiaProvider + + client_id: '%env(OAUTH2_TRACKMANIA_CLIENTID)%' + client_secret: '%env(OAUTH2_TRACKMANIA_SECRET)%' + redirect_route: connect_trackmania_check + redirect_params: {} +``` + +and in the `config/packages/security.yaml` file, in the security -> firewalls -> main part: + +remove the property `provider` and add these lines: + +```yaml +custom_authenticators: + - App\Security\TrackManiaAuthenticator + +logout: + path: app_logout +``` + +After that, you will need to get the Client ID and the Secret on https://api.trackmania.com/ and add them in your `.env` file like this: + +``` +OAUTH2_TRACKMANIA_CLIENTID=XXXXXXXXXXXXXXXXXXX +OAUTH2_TRACKMANIA_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +``` \ No newline at end of file