# The taClient.addAuthorizedUser() method
This documents the `taClient.addAuthorizedUser()` method.
info
Async: This is a method you would want to use await with
This method has input parameters. The function could easily be defined as:
```ts
async function addAuthorizedUser(tournamentId: string, discordId: string, roleIds: string[]): Promise {
// backend logic
}
```
## General usage:
```ts
const response: Response = taClient.addAuthorizedUser(tournamentGuid, userDiscordId, ['roleId1', 'roleId2'])
```
The `response` variable from above will actually be a 'mashup' of two types. Firstly, the standard `Response` type. Secondly the `Response_AddAuthorizedUser`. Find the custom response object below.
```js
{
details: {
addAuthorizedUser: Response_AddAuthorizedUser,
oneofKind: 'addAuthorizedUser'
},
respondingToPacketId: 'packet-guid-uuidv4',
type: Response_ResponseType
}
```
- For `Response` please find documentation at [Modals -> Response](/documentation#Modals/4-Response)
- For `Response_AddAuthorizedUser` please find documentation at [Modals -> Response_AddAuthorizedUser](/documentation#Modals/4-Response_AddAuthorizedUser).
info
Note: The method uses role.roleId, not role.guid.
```ts
// This is some base data about the user passed on from the popup where we add the authorised user
const userData = event.detail;
// Log the user data that is passed on
console.log('Adding user:', userData);
try {
// Try to add the authorised user given their discord / platform id to the tournament with the selected roles
let addAuthorizedUserResult = await client.addAuthorizedUser(tournamentGuid, userData.discordId, userData.roleIds);
// If successful, add to the authorizedUsers array
if (addAuthorizedUserResult.type === Response_ResponseType.Success) {
authorizedUsers = [...authorizedUsers, userData];
}
} catch (err) {
console.error('Error adding user:', err);
// If there is an error, display it and tell the user to show us the data passed on from the popup.
error = "Failed to add user, please view console, screenshot it and send it to serverbp or matrikmoon on Discord.";
}
```
info
Example: A direct example is not available, as this function is not used in ShyyTAUI.