I am working on sharing of resources between multiple users using keycloak. After creating a resource when I request for ticket permission I get 400, but the issue is these 400 is not constant some time the response is 200 and sharing is perfect but there some cases I get 400 response. 400 is bad request the payload I am sending are correct every time. These 400 are not consistent that's why I find it very difficult to debug it.
def _owner_action_scopes(owner_token, resource_id, scope, requester, granted):
ticket_url = f"{server_internal_url}realms/{realm_name}/authz/protection/permission/ticket"
data = {"resource": resource_id,
"requester": requester,
"granted": granted,
"scopeName": scope}
headers = {}
headers["Content-Type"] = "application/json"
headers["Authorization"] = f"Bearer {token}"
headers["Host"] = kc_host
status = requests.post(ticket_url, headers=headers, data=json.dumps(data), verify=VERIFY)
return status