VMware vidm api: “User is not authorized to perform the task” [Generate OAuth Bearer Token]

issue: For one of the automation task for vmware vidm get attribute api, for admin user the code was failing.
It was giving error message “User is not authorized to perform the task”

Steps:
After creating the Remote App Access client, generate an OAuth bearer token.

Create Remote app client:

https://docs.vmware.com/en/VMware-Workspace-ONE/services/workspaceone_okta_scim_provisioning/GUID-9D0D3460-6D9B-4022-ACFA-619D849453CA.html#GUID-9D0D3460-6D9B-4022-ACFA-619D849453CA

Prerequisites
Download and install the Postman app. You can download Postman from https://getpostman.com

Steps to generate Oatuh Bearer token