Google Cloud Pub / Sub Publishing From Browser - How Does Auth Work?

I have a requirement to use the Google Cloud Pub / Sub API directly from the browser (similar to GA script). I was wondering how Auth can be handled without requiring passing through a server server.

I want to call the Cloud Pub / Sub API directly from the browser. I tried, and he says that I need to authenticate first, my problem is how to protect the Auth token.

Is there any javascript library that is available that I can use in a browser (without a backend) to call the Google Pub / Sub API.

Thank you in advance

+6
source share
1 answer

The general Javascript approach for authorizing and authorizing Google API requests is shown at https://developers.google.com/api-client-library/javascript/samples/samples#AuthorizingandMakingAuthorizedRequests - it is not defined for the Pubsub Cloud API, but it should work for all Google APIs. Similarly, https://developers.google.com/api-client-library/javascript/start/start-js for sharing Javascript to the Google APIs.

+3
source

Source: https://habr.com/ru/post/983885/


All Articles