Re: problem with blogger java v3 api authentication

John Walton <[email protected]>
Newsgroups gmane.comp.web.blogger.api
Message-ID <[email protected]>
Sorry Brett, I don't have a clue how " Blogger policy is that all users of 
the service agree to our terms of service" relates to my last query:

    "Is there* any* way now for an unattended Web Server Application to 
post blogs to blogger, using only "own data" and no user data (i.e. without 
user login)?"

And I cannot find any Blogger policy that states that such blog entries 
cannot be posted; please a specific reference to the T&C.

John


On Tuesday, February 16, 2016 at 11:51:17 PM UTC, Brett Morgan wrote:

> The Blogger policy is that all users of the service agree to our terms of 
> service.
>
> On Wed, Feb 17, 2016 at 10:22 AM John Walton <[email protected] 
> <javascript:>> wrote:
>
>>  Brett,
>>
>> Thanks very much for that reply; clarifies that Blogger API V3 Service 
>> Accounts do not work.
>>
>> This leaves the one major outstanding issue, an answer to which I am sure 
>> would be appreciated by many hundreds of Blogger developers:
>>
>> Is there* any* way now for an unattended Web Server Application to post 
>> blogs to blogger, using only "own data" and no user data (i.e. without user 
>> login)?
>>
>> John 
>>
>>
>> On Tuesday, February 16, 2016 at 12:01:01 AM UTC, Brett Morgan wrote:
>>
>>> Hi John, 
>>>
>>> Sorry for the misleading documentation, I'll get the documentation 
>>> updated so that it reflects reality.
>>>
>>> brett
>>>
>>> On Tue, Feb 16, 2016 at 10:41 AM John Walton <[email protected]> 
>>> wrote:
>>>
>> Brett, I assume you are posting on behalf of Google / Blogger?
>>>>
>>>> If Blogger does not accept Service logins, then why:
>>>>
>>>> 1. Does "Blogger API: Using the API"
>>>>
>>>> https://developers.google.com/blogger/docs/3.0/using
>>>>
>>>> state:
>>>>
>>>> "Service accounts
>>>>
>>>> A service account is used in an application that calls APIs on behalf 
>>>> of an application that does not access user information. This type of 
>>>> application needs to prove its own identity, but it does not need a user to 
>>>> authorize requests. The *Google Accounts documentation* 
>>>> <https://developers.google.com/accounts/docs/OAuth2#serviceaccount> 
>>>> contains more details about service accounts.
>>>>
>>>>
>>>> 2.  You have a "Help me choose" wizard in the Google Developers Console 
>>>> / Credentials. 
>>>>
>>>>
>>>> https://console.developers.google.com/apis/credentials/wizard?project=thermal-diorama-111315
>>>>
>>>> If I select "Blogger API V3", from Web Server, Application data, no 
>>>> Google engine, it tells me I can use my existing "Service account 1" !!!
>>>>
>>>> So are the above all lies?
>>>>
>>>> Before V3 I had no problems posting entries to my blog (using my own 
>>>> blogger data). It now seems impossible, and all above information on Google 
>>>> web pages about the subject seems to be in error..
>>>>
>>>> Please help - very simple requirement!
>>>>
>>>> Previously posted, in more detail, on Jan 31, with no response.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Tuesday, June 2, 2015 at 7:18:38 AM UTC+1, Brett Morgan wrote:
>>>>
>>>>> We don't accept service account logins on Blogger, sorry.
>>>>>
>>>>> brett
>>>>>
>>>>> On Tue, Jun 2, 2015 at 4:12 PM Paul Foxson <[email protected]> wrote:
>>>>>
>>>> Hi
>>>>>> I'm trying run a sample post insert using Blogger JAVA v3 api and 
>>>>>> running into issues.   Please let me know what I'm missing or doing 
>>>>>> incorrectly or my setup is incorrect.
>>>>>> Our applications runs periodically without any user interaction and 
>>>>>> automatically post to our blog.  Process runs on a stand alone machine 
>>>>>> without any user interaction. It was working fine before gdata was 
>>>>>> deprecated.   
>>>>>>
>>>>>> I took the following steps:
>>>>>> 1. enabled Blogger API v3 in developer console.   
>>>>>> 2. created a service account under credentials and downloaded .p12 
>>>>>> file.   (I assume service accounts are supported since 
>>>>>> google-api-services-blogger-v3-rev48-java-1.20.0 has calls 
>>>>>> like setServiceAccountId, setServiceAccountScopes 
>>>>>> and setServiceAccountPrivateKeyFromP12File).
>>>>>> 3. downloaded google-api-services-blogger-v3-rev48-java-1.20.0
>>>>>>
>>>>>> Running code below and getting, this error:
>>>>>> com.google.api.client.googleapis.json.GoogleJsonResponseException: 
>>>>>> 403 Forbidden
>>>>>> {
>>>>>>   "code" : 403,
>>>>>>   "errors" : [ {
>>>>>>     "domain" : "global",
>>>>>>     "message" : "We're sorry, but you don't have permission to access 
>>>>>> this resource.",
>>>>>>     "reason" : "forbidden"
>>>>>>   } ],
>>>>>>   "message" : "We're sorry, but you don't have permission to access 
>>>>>> this resource."
>>>>>> }
>>>>>> at 
>>>>>> com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145)
>>>>>> at 
>>>>>> com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
>>>>>> at 
>>>>>> com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
>>>>>> at 
>>>>>> com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:321)
>>>>>> at 
>>>>>> com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1056)
>>>>>> at 
>>>>>> com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
>>>>>> at 
>>>>>> com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
>>>>>> at 
>>>>>> com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
>>>>>> at testAuth.main(testAuth.java:136)
>>>>>>
>>>>>> -------------------------------------------
>>>>>> my code:
>>>>>> try {
>>>>>> HttpTransport httpTransport = 
>>>>>> GoogleNetHttpTransport.newTrustedTransport();
>>>>>> JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
>>>>>>
>>>>>> GoogleCredential credential = 
>>>>>> new GoogleCredential.Builder()
>>>>>>
>>>>>> .setTransport(httpTransport)
>>>>>>
>>>>>> .setJsonFactory(jsonFactory)
>>>>>>
>>>>>> .setServiceAccountId("[email protected]")
>>>>>>
>>>>>> .setServiceAccountScopes(Collections.singleton(BloggerScopes.BLOGGER))
>>>>>>
>>>>>> .setServiceAccountPrivateKeyFromP12File(new File("xxxxxxxxxxx.p12")) 
>>>>>>
>>>>>> .build();
>>>>>>
>>>>>>
>>>>>> Blogger blogger = new Blogger.Builder(httpTransport, jsonFactory, 
>>>>>> credential)
>>>>>> .setApplicationName("My Project")
>>>>>> .build();
>>>>>>
>>>>>> // Construct a post to insert
>>>>>> Post content = new Post();
>>>>>> content.setTitle("A test post");
>>>>>> content.setContent("With <code>HTML</code> content");
>>>>>>
>>>>>> String TEST_BLOG_ID = "xxxxxxxxxxx9897";
>>>>>>
>>>>>> Insert postsInsertAction = blogger.posts().insert(TEST_BLOG_ID, 
>>>>>> content);
>>>>>>
>>>>>> // Restrict the result content to just the data we need.
>>>>>>
>>>>>> postsInsertAction.setFields("author/displayName,content,published,title,url");
>>>>>>
>>>>>> // This step sends the request to the server.
>>>>>> Post post = postsInsertAction.execute();   //fails here
>>>>>>
>>>>>> // Now we can navigate the response.
>>>>>> System.out.println("Title: " + post.getTitle());
>>>>>> System.out.println("Author: " + post.getAuthor().getDisplayName());
>>>>>> System.out.println("Published: " + post.getPublished());
>>>>>> System.out.println("URL: " + post.getUrl());
>>>>>> System.out.println("Content: " + post.getContent());
>>>>>>
>>>>>> } catch (GeneralSecurityException e) {
>>>>>> // TODO Auto-generated catch block
>>>>>> e.printStackTrace();
>>>>>> } catch (IOException e) {
>>>>>> // TODO Auto-generated catch block
>>>>>> e.printStackTrace();
>>>>>> }
>>>>>>
>>>>>> -- 
>>>>>> 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.
>>>>>>
>>>>> -- 
>>>> 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 https://groups.google.com/group/bloggerdev.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/bloggerdev.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 https://groups.google.com/group/bloggerdev.
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.