> For the complete documentation index, see [llms.txt](https://docs.lithnet.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lithnet.io/ams/v3.0/help-and-support/support-articles/kb000001.md).

# KB000001: The Access Manager Agent cannot connect and logs a token-validation-failed error

## Summary

The Lithnet Access Manager agent may show the following error message in the agent log file

```
LithnetAccessManagerAgent[909131]: Lithnet.AccessManager.Agent.LinuxLapsAgent[1006] The LAPS agent process encountered an error
Lithnet.AccessManager.Agent.ApiException: The API call failed with HTTP status Unauthorized:Unauthorized. The API returned error code 'token-validation-failed'
```

The server will show a corresponding error message in the `access-manager-api.log` file

```
|ERROR|Lithnet.AccessManager.Api.ApiErrorResponseProvider|The security token failed the validation process

Microsoft.IdentityModel.Tokens.SecurityTokenInvalidAudienceException: IDX10214: Audience validation failed. Audiences: 'System.String'. Did not match: validationParameters.ValidAudience: 'System.String' or validationParameters.ValidAudiences: 'System.String'.
```

## Cause

This issue occurs because the hostname configured as the `External host name` on the server, differs from the host name provider at agent registration time

## Resolution

### Step 1: Validate server-side external host name

To resolve this issue, first check that the `External host name` field is correct on the server side.

![](https://1500666603-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzPrDxVWpXXpSNTpkDVnR%2Fuploads%2Fgit-blob-3219305a5244ced089f5b7424b3f96eb370907f0%2Fui-page-host-configuration.png?alt=media)

### Step 2: Validate client-side configuration

On the client side, ensure the matching name has been specified during the setup process.

#### Linux

Run the following command to repeat the setup process, and provide the correct hostname

```shell
/opt/LithnetAccessManagerAgent/Lithnet.AccessManager.Agent --setup
```

#### macOS

Run the following command to repeat the setup process, and provide the correct hostname

```shell
/Applications/LithnetAccessManagerAgent/Lithnet.AccessManager.Agent --setup
```

#### Windows

Run the following command to repeat the setup process, and provide the correct hostname

```batch
"C:\Program Files\Lithnet\Access Manager Agent\Lithnet.AccessManager.Agent.exe" --setup
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.lithnet.io/ams/v3.0/help-and-support/support-articles/kb000001.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
