docs: add re-use error handler section + clarify allowUnregistered (#12780)

* docs: add re-use error handler section + clarify allowUnregistered

* fixes
This commit is contained in:
Shahed Nasser
2025-06-19 19:37:26 +03:00
committed by GitHub
parent 0b9819a7e2
commit b92bdfe7e1
5 changed files with 151 additions and 65 deletions
@@ -137,7 +137,7 @@ The `authenticate` middleware function accepts three parameters:
2. An array of types of authentication methods allowed. Both `user` and `customer` scopes support `session` and `bearer`. The `admin` scope also supports the `api-key` authentication method.
3. An optional object of configurations accepting the following properties:
- `allowUnauthenticated`: (default: `false`) A boolean indicating whether authentication is required. For example, you may have an API route where you want to access the logged-in customer if available, but guest customers can still access it too.
- `allowUnregistered` (default: `false`): A boolean indicating if unregistered users should be allowed access. This is useful when you want to allow users who arent registered to access certain routes.
- `allowUnregistered` (default: `false`): A boolean indicating whether users can access this route with a registration token, instead of an authentication token. This is useful if you have a custom actor type, such as `manager`, and you're creating an API route that allows these users to register themselves. Learn more in the [Custom Actor-Type Guide](!resources!/commerce-modules/auth/create-actor-type).
### Example: Custom Actor Type