I am trying publish to google PubSub from my .NET Core App. I have already created the PubSub and a Topic in Google PubSub. I downloaded the private key json file and included in my project. I am able to read the file and create the credential but I don't see a way to pass the credential to Google's PubSub Publisher client. I have looked at the GitHub Post but unfortunately I am not seeing a property named DefaultEndPoint.
Running my code generates an error which is looking for environment variable for credential. I do not want to set the environment variable for now and if there is no alternative I will try that.
Following is my code and let me know what I am doing wrong of is something that got changed recently.
var credential = GoogleCredential.FromFile("app-services.json"); PublisherClient publisher = PublisherClient.CreateAsync(topicName).Result;