Is it possible to add , remove and edit user grants through scripting?
Hope this will help you !!!
Best to point people at the current documentation:
Is User Grants not exposed in scripting yet?
I cannot find it in the section you provided.
This isn't possible right now.
Grants aren't actually part of a user, they belong to a complicated configuration object associated with an IdP.