How do you print out messages back to the client from a plugin?

Using Golang.

I maintain a plugin that has two ways to authenticate: OAuth or a service account. I use a system command open to open your browser automatically to the OAuth authorization URL, but that can fail. I want to send a message back to the client from the server with a message like “Open your browser this URL:” but I have not seen an example of how to do this.

Hi

Sorry for the delayed reply.

Would you mind providing some more details of how the auth flow is working? In particular how the credentials are handled after the open command is run and how they would be handled if a message is returned to the client to “Open your browser at this URL”.

Many thanks,
Martin

I appreciate your reply. I’m not sure the details of the auth flow are important here. Nonetheless, the flow is here: cq-source-googleworkspace/client/oauth.go at main · jsifuentes/cq-source-googleworkspace · GitHub

So on line 126, instead of returning the error upstream to the client, I’d like to send a message to the client instructing them to proceed manually. I unfortunately haven’t seen an example of how to do this in another CloudQuery module.

Hi,

You should be able to write a log message in the plugin with instructions of what manual steps you would like the user to take. When running the cloudquery CLI you can specify --log-console to see the logs realtime on the console e.g.

cloudquery sync <sync.yml> --log-console

Let me know if this helps,
Martin