Reputation: 476
I was trying to push some data to PUB/SUB as mentioned here
I assume, the URL "POST https://pubsub.googleapis.com/v1/projects/myproject-id/topics/mytopic-name:publish" with needed data in a json format as described , would publish the data to the pubsub. Is my assumption correct here? or should I write my own handler to publish the data which i get from a webpage using java/php/python etc?
I could successfully push the data through google play ground. But this requires my username/password to be given to authenticate.
Can I use API_KEY alone here to send the data from my webpage to google pubsub? Or should I go for OAuth2.0 login? If OAuth is used, is there any way to provide the client_id and the API_KEY to do the authentication without prompting the user to enter credentials?
Any help on the above topics would be really appreciated.
Thanks
Upvotes: 1
Views: 5494
Reputation: 812
You might be better off using one of the client libraries with a service account. This will make authentication straightforward, by setting the GOOGLE_APPLICATION_CREDENTIALS environment variable. If you cannot do this for some reason, you can set the Authorization: Bearer header with an OAuth token as shown here.
Upvotes: 2