# Authenticate API User Example

> Learn how to validate an API user using the x-am-authorization header in API Maker with a clear, working example.

Source: https://docs.apimaker.dev/v1/examples/req/auth/authAMUser.html

### Authorization of AM API user

To get the value of request header `x-am-authorization`, use `g.req.auth.authAMUser`.

```ts
const am_api_user_auth = g.req.auth.authAMUser;
```

### Get token of API user

- For more information [click here](https://docs.apimaker.dev/v1/docs/apis-all/system-apis/system-generated-token-api.html).

```json
{
    "authTokenType": "AM",
    "authTokenAM": {
        "u": "API_user_username",
        "p": "API_user_password"
    }
}
```

## Related

- [The global object g](https://docs.apimaker.dev/v1/docs/pre-defined-terms/global-object-g.html) · [Custom APIs](https://docs.apimaker.dev/v1/docs/apis-all/custom-apis/user-created-custom-api.html)
