Authorization problem when updating a page in Blogger with Java

[email protected]
Newsgroups gmane.comp.web.blogger.api
Message-ID <[email protected]>
Hi.

I'm getting a GoogleJsonResponseException 401 Unauthorized Error when I try 
to update a page in Blogger using a desktop application coded in Java.
The code is this:

        HttpTransport httpTransport = 
GoogleNetHttpTransport.newTrustedTransport();
        JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance();
        
        List<String> serviceAccountScopes = new ArrayList<String>();
        serviceAccountScopes.add("https://www.googleapis.com/auth/blogger");
        serviceAccountScopes.add(BloggerScopes.BLOGGER);
        
        Credential credential = new GoogleCredential.Builder()
            .setTransport(httpTransport)
            .setJsonFactory(jsonFactory)
            .setServiceAccountId("*******@developer.gserviceaccount.com")
            .setServiceAccountUser("[email protected]")
            .setServiceAccountPrivateKeyFromP12File(new File("key.p12"))
            .setServiceAccountScopes(serviceAccountScopes)
            .build();

        blogger = new Blogger.Builder(httpTransport, jsonFactory, null)
                      
.setApplicationName("*********.apps.googleusercontent.com")
            .build();

        myEntry = new Page();
        myEntry.setTitle("Estrenos");
        myEntry.setContent(pagina);
        
        String pageID = "6734608486126438390";
                
        blogger.pages().update(blogID, pageID, myEntry).execute();

What am I doing wrong?

Thank you.

-- 
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.
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.