public void Publish(string title, string content, string tags) { string serviceAccountEmail = "serviceac...@appspot.gserviceaccount.com"; string impersonateEmail = "som...@gmail.com"; string privateKey = "-----BEGIN PRIVATE KEY-----REMOVED_FOR_FORUM-----END PRIVATE KEY-----\n";
var credentials = new Google.Apis.Auth.OAuth2.ServiceAccountCredential( new Google.Apis.Auth.OAuth2.ServiceAccountCredential.Initializer(serviceAccountEmail) { Scopes = new string[] { //Google.Apis.Blogger.v3.BloggerService.Scope.BloggerReadonly, Google.Apis.Blogger.v3.BloggerService.Scope.Blogger }, //User = impersonateEmail }.FromPrivateKey(privateKey) );
var srv = new Google.Apis.Blogger.v3.BloggerService(new Google.Apis.Services.BaseClientService.Initializer() { HttpClientInitializer = credentials, ApplicationName = "Blogger" }); var cander = srv.Posts.List(_blogId); var exec = cander.Execute(); var insertRequest = srv.Posts.Insert(new Google.Apis.Blogger.v3.Data.Post() { Kind = "blogger#post", Blog = new Google.Apis.Blogger.v3.Data.Post.BlogData() { Id = _blogId }, Title = title, Content = content }, _blogId); var post = insertRequest.Execute(); // THIS IS FAILING var publishRequest = srv.Posts.Publish(_blogId, post.Id); var publish = publishRequest.Execute(); if (publish.Status != "Published") throw new Exception("Probando"); }Google.Apis.Requests.RequestErrorWe're sorry, but you don't have permission to access this resource. [403]Errors [ Message[We're sorry, but you don't have permission to access this resource.] Location[ - ] Reason[forbidden] Domain[global]]Hi, I'm trying to post in Blogger using the C# API.Here's my code:
public void Publish(string title, string content, string tags){
string serviceAccountEmail = "serviceaccountName@appspot.gserviceaccount.com";
To clarify, is `impersonateEmail` an account in your Google Apps domain? And have you delegated permission for this application to impersonate accounts in your domain (https://developers.google.com/identity/protocols/OAuth2ServiceAccount#delegatingauthority)?
On Saturday, November 5, 2016 at 1:57:23 AM UTC-7, Matías Kusack wrote:
Hi, I'm trying to post in Blogger using the C# API.Here's my code:
public void Publish(string title, string content, string tags){
string serviceAccountEmail = "serviceac...@appspot.gserviceaccount.com";
--
You received this message because you are subscribed to a topic in the Google Groups "Google APIs Explorer Users Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apis-explorer-users/RkD7NvkdxCk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apis-explorer-users+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
In google docs says that the service account is the way to connect server to server. I'm developing a feature so the ASP.NET WebSite can add blog posts on certain events, unattended. Other ways, like OAuth2.0 ask me for a password any time, is that wright?This is the page I was inspired by https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth#service-accountIs there any other way to do this? I just want to create a new post on a blog I've created for my WebSite.Thanks
Matías
Matías
To unsubscribe from this group and all its topics, send an email to google-apis-explorer-users+unsubsc...@googlegroups.com.
Hi, sorry that take me so long to answer back, I was working with other stuff.I've been rereading everything and I'm staring to fear that I cannot achieve what I want.The workflow I'm thinking on is:1.- Application detects an internal event2.- It sends a Blog3.- EndThe thing here is that it has tu be unattended, no user interaction can take place.On the other hand, in this page https://developers.google.com/blogger/docs/3.0/using says:"Requests to the Blogger API for non-public user data must be authorized by an authenticated user."If I am understanding it correctly I'm not going to be able to create a new Blog post without user interaction.What are service accounts for so?I haven't been able to give a service account permissions to access any blog, what am I doing wrong?
Matías
Matías
To unsubscribe from this group and all its topics, send an email to google-apis-explorer-users+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Matías
Matías
To unsubscribe from this group and all its topics, send an email to google-apis-explorer-users+unsubsc...@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "Google APIs Explorer Users Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apis-explorer-users/RkD7NvkdxCk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apis-explorer-users+unsubsc...@googlegroups.com.
Ok, thanks for answering again.Option 1 is deprecated, I've tried it and after developing it I realized that google has discontinued it and ClientLogin fails.Option 2 is not even an option, since customer is not willing to pay.So, thanks for the effort, I'm gonna develop the OAuth or change Blog provider. Customer's desition.
Matías
Matías
Matías
To unsubscribe from this group and all its topics, send an email to google-apis-explorer-users+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Google APIs Explorer Users Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apis-explorer-users/RkD7NvkdxCk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apis-explorer-users+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.