> For the complete documentation index, see [llms.txt](https://docs.navigaglobal.com/navigaid/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.navigaglobal.com/navigaid/shared-modules/service-authorization-lib/accessdenied.md).

# AccessDenied

## AccessDenied⇐ `ServiceAuthorizationError` <a href="#accessdenied" id="accessdenied"></a>

AccessDenied Error - extending the ServiceAuthorizationError error class

PublicMessage is set to 'Access denied' and the HttpCode is set to '403'.

Thrown when a users credentials does not match the requested endpoints credentials.

**Extends**: `ServiceAuthorizationError`

### new AccessDenied(publicData, internalData)

| Param        | Type     | Description                                                 |
| ------------ | -------- | ----------------------------------------------------------- |
| publicData   | `Object` | **Required -** Data to show in the error                    |
| internalData | `Object` | **Required -** Private data that can be logged in the error |

## hapiReply(replyOrResponseToolkit, \[extraPublicData]) ⇒ `Object` <a href="#hapireply" id="hapireply"></a>

Reply function to respond with the error

**Overrides**: `ServiceAuthorizationError#hapiReply`\
**Returns**: `Object` - Response - Response object

| Param                  | Type     | Default | Description                                                                           |
| ---------------------- | -------- | ------- | ------------------------------------------------------------------------------------- |
| replyOrResponseToolkit | `Object` |         | **Required -** Response toolkit - For example 'h' in Hapi, which handles the response |
| extraPublicData        | `Object` | `{}`    | Extra public data to shown in the error message                                       |
