We're sorry, but you don't have permission to access this resource. [403]
s34nVideos <[email protected]>
| Newsgroups | gmane.comp.web.blogger.api |
|---|---|
| Message-ID | <[email protected]> |
Hi There,
I'm having such a hard time sifting through the existing documentation to
find a working example on how to consume the Blogger v3 API with my C#
WinForms client application. A lot of the documentation on the internet is
outdated and the methods and deprecation's alter so fast it's hard to get
something stable and working correctly.
I think I have the code down, but it keeps throwing this 403 error. I've
checked permissions in the Google API Page and in my app, and i'm totally
lost!!
public void NewPost()
{
// Init secret
ClientSecrets secrets = new ClientSecrets();
secrets.ClientId =
Properties.Settings.Default.Blogger_OAuth_ClientID;
secrets.ClientSecret =
Properties.Settings.Default.Blogger_OAuth_ClientSecret;
// Opens web browser to approve request
UserCredential credential = await
GoogleWebAuthorizationBroker.AuthorizeAsync(
secrets,
new[] { BloggerService.Scope.Blogger },
"user", System.Threading.CancellationToken.None);
// Init Blogger service
blogService = new BloggerService(new
BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApiKey = Properties.Settings.Default.Blogger_APIBrowserKey,
ApplicationName = "bloggerhelper1"
});
PostsResource postsRes = new PostsResource(blogService);
Post existingPost = GetPosts().Items[0]; // Here I am playing
around by getting the Author and Blog info from existing post to see if
that caused a permissions issue.
// Init Post info
Post newPost = new Post();
newPost.Blog = existingPost.Blog;
newPost.Title = "Test title for blog";
newPost.Content = "Description test for blog";
newPost.Author = existingPost.Author;
PostsResource.InsertRequest postInsertReq =
postsRes.Insert(newPost, Properties.Settings.Default.Blogger_BlogID);
Post postedPost = postInsertReq.Execute(); // throws a
GoogleApiException: "We're sorry, but you don't have permission to access
this resource. [403]"
blogService.Dispose();
}
Anything I might have overlooked?
--
You received this message because you are subscribed to the Google Groups "Blogger Developer Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/bloggerdev.
For more options, visit https://groups.google.com/d/optout.