Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Improve troubleshooting explanations with an Authenticated API #1826

Open
wants to merge 4 commits into
base: 3.2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions create-client/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`.

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

Expand Down