Given
curl --request POST 'https://pubsub.googleapis.com/v1/projects/myproject/topics/mytopic:publish?key=[API_KEY]'
--header 'Content-Type: application/json'
--data '{"messages":[]}'
I'm getting the following:
{ "error": { "code": 403, "message": "User not authorized to perform this action.", "status": "PERMISSION_DENIED" } }
Where using service account and OAuth2 works ok.
What's the best way to debug this?
Thanks
EDIT: I'd like to add that I want to use an API key because I'm creating a ptowhich will run on a server without an option to use the PubSub Client SDKs (I'm using vector.dev HTTP sink), so using a service account is not an option.
Pub/Sub does not support the use of API keys as an authentication method. API keys are used for quota attribution for requests. As noted in the documentation, "most Google Cloud APIs don't support API keys."