简体   繁体   中英

Sending messages to google cloud pubsub topic from browser without authentication

I want to write a simple javascript plugin that can send pubsub messages from the browser. But because these clients may not be (or may not want to) log in, I would like to have the plugin be able to send pubsub message unauthenticated. Is that possible? If not, what would be the best way to achieve this.

The specific use case here is: writing an web analytics plugin that can track something like page load and other events.

Sending pub/sub messages would require one to be authenticated against the project where the topic was created. Your client logging into a Google account would not be relevant unless you planned to give every user of the page access to your project.

What you probably want to do is have a service running that is authenticated to publish messages. Requests from the browser would be sent unauthenticated to this service and then you could publish a message (after some verification that it is a legitimate message, I expect) into Google Cloud Pub/Sub.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM