Ensure that the private_key_path is correct and points to the valid .p8 private key file. If the private key is not valid or mismatched, the JWT cannot be signed correctly.
---------------
Before sending the request, print out the JWT (gen_jwt) and verify that it looks correct. You can decode it locally using a tool like jwt.io to verify its contents.