I am attempting to add features to a feature service as part of an automated script using the REST API. However when I POST to the /addFeatures resource I get Error 500 - "User does not have the privilege to perform this operation."
I created an application on our Portal site where the hosted feature service is published. The feature service is shared only with a group.
I am using a token that i get from making a POST request to /portal/sharing/rest/oauth2/token on our ArcGIS Enterprise site (10.8.1) with the following body:
client_id=<app id>
grant_type=client_credentials
client_secret=<app secret>
This successfully returns an access token. I can use the token to query the feature service, but not to addFeatures. It seems like the application has read permissions to the feature service but not write.
Is there some way to grant the application credentials access to the feature service for editing?
Edit: By the way, editing is enabled and I can manually use the /addFeatures REST page to add features after signing in. Making a request with the token fails though.