From 7980f5bfa820d3e093483b369a60e6ea0e9a53af Mon Sep 17 00:00:00 2001 From: adrien guernier Date: Tue, 31 Oct 2023 18:53:53 +0100 Subject: [PATCH 1/3] Improve troubleshooting authentication explanations --- create-client/troubleshooting.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/create-client/troubleshooting.md b/create-client/troubleshooting.md index 72a16eddd7b..1243b7462ff 100644 --- a/create-client/troubleshooting.md +++ b/create-client/troubleshooting.md @@ -20,6 +20,21 @@ api_doc ANY ANY ANY /docs.{_form api_jsonld_context ANY ANY ANY /contexts/{shortName}.{_format} ``` +For instance, the `access_control` definition in the `security.yaml` could look like this: +```yaml +access_control: + - { path: ^/index.jsonld, roles: PUBLIC_ACCESS } + - { path: ^/docs.jsonld, roles: PUBLIC_ACCESS } + - { path: ^/contexts/hydra.jsonld, roles: PUBLIC_ACCESS } + - ... +``` + +You can also define a `--bearer` arg in case of [JWT authentication](../core/jwt.md), or the `--username` and `--password` arguments in case of basic authentication: +```console +docker compose exec pwa \ + pnpm create @api-platform/client --resource book -g next --bearer eyJ0eXAiOiJKV1QiLCJhbGciO... +``` + ## ApiDocumentation doesn't exist If you receive `Error: The class http://www.w3.org/ns/hydra/core#ApiDocumentation doesn't exist.` you may have @@ -52,9 +67,10 @@ url: 'https://demo.api-platform.com/contexts/Entrypoint', cause: null } } ``` -Check access to the specified URL, in this case `https://demo.api-platform.com/contexts/Entrypoint`, use curl to check -access and the response `curl https://demo.api-platform.com/contexts/Entrypoint`. In the above case an "Access Denied" -message in JSON format was being returned. +Check access to the specified URL, in this case `https://demo.api-platform.com/contexts/Entrypoint`, use `curl` to check +access and the response `curl https://demo.api-platform.com/contexts/Entrypoint`. + +In the above case an "Access Denied" message in JSON format was being returned. To fix this, you have the possibility to specify `If your API is protected with JWT You can specify ## Docker distribution on Windows and hot-reloading From acbbc4652fe17d7514165059e2e65a9262a610ae Mon Sep 17 00:00:00 2001 From: adrien guernier Date: Wed, 15 Nov 2023 14:32:35 +0100 Subject: [PATCH 2/3] remove trailing spaces --- create-client/troubleshooting.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/create-client/troubleshooting.md b/create-client/troubleshooting.md index 1243b7462ff..617ea18811b 100644 --- a/create-client/troubleshooting.md +++ b/create-client/troubleshooting.md @@ -68,9 +68,9 @@ cause: null } } ``` Check access to the specified URL, in this case `https://demo.api-platform.com/contexts/Entrypoint`, use `curl` to check -access and the response `curl https://demo.api-platform.com/contexts/Entrypoint`. +access and the response `curl https://demo.api-platform.com/contexts/Entrypoint`. -In the above case an "Access Denied" message in JSON format was being returned. To fix this, you have the possibility to specify `If your API is protected with JWT You can specify +In the above case an "Access Denied" message in JSON format was being returned. To fix this, you have the possibility to specify `If your API is protected with JWT You can specify. ## Docker distribution on Windows and hot-reloading From 2f130958185f256802e3e5db0da97709abd77889 Mon Sep 17 00:00:00 2001 From: adrien guernier Date: Wed, 15 Nov 2023 16:13:09 +0100 Subject: [PATCH 3/3] correct a wrong sentence --- create-client/troubleshooting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create-client/troubleshooting.md b/create-client/troubleshooting.md index 617ea18811b..8f04581ea07 100644 --- a/create-client/troubleshooting.md +++ b/create-client/troubleshooting.md @@ -70,7 +70,7 @@ cause: null } } Check access to the specified URL, in this case `https://demo.api-platform.com/contexts/Entrypoint`, use `curl` to check access and the response `curl https://demo.api-platform.com/contexts/Entrypoint`. -In the above case an "Access Denied" message in JSON format was being returned. To fix this, you have the possibility to specify `If your API is protected with JWT You can specify. +For instance, your API is protected by a JWT strategy, so in the above case an "Access Denied" message in JSON format was being returned. To fix this, you can set the `--bearer` flag with a valid token. ## Docker distribution on Windows and hot-reloading