Not able to add user using rsconnect::addAuthorizedUser()

I was trying to add user under the section of "Who can view or change this Application" by calling the addAuthorizedUser() function from rsconnect library.

I am able to configure it manually by changing the Access settings as the picture below:

However, when using the addAuthorizedUser(email = "test@gmail.com") function
throw an error of api$inviteApplicationUser stated below:
Error in api$inviteApplicationUser(application$id, validateEmail(email), :
attempt to apply non-function

Please advice on the above issue.

The rsconnect package addAuthorizedUser capability is currently only supported for shinyapps.io, not RStudio Connect.

The connectapi package, GitHub - rstudio/connectapi: An R package for interacting with the RStudio Connect Server API, has an experimental function for adding users programmatically called acl_add_user . This function is not officially supported but could be useful for you.

The latest versions of Connect also include an officially supported API endpoint that can be used for this purpose as well: RStudio Connect API Reference