Open maxlam79 opened 9 years ago
Exception in thread "main" com.tumblr.jumblr.exceptions.JumblrException: Not Authorized
at com.tumblr.jumblr.request.RequestBuilder.clear(RequestBuilder.java:156)
at com.tumblr.jumblr.request.RequestBuilder.postMultipart(RequestBuilder.java:58)
at com.tumblr.jumblr.JumblrClient.postEdit(JumblrClient.java:361)
at com.tumblr.jumblr.types.Post.save(Post.java:348)
at App.main(App.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
The "Not Authorized" exception is caused by setting an ID with the following line:
photoPost.setId( 1232 );
If you want to create a new PhotoPost
with the above contents remove that line and it will work. If you want to edit an existing post then you'll have to follow the post editing flow in the docs. I tested and got your snippet to work by removing the setId
line.
Let me know if this resolves your issue.
Hi,
I'm getting this exception message: "com.tumblr.jumblr.exceptions.JumblrException: Not Authorized" when I try to perform a PhotoPost.save();
How to reproduce: 1) I have my consumer key and consumer secret ready 2) Obtained the token and token secret through web browser: https://api.tumblr.com/console/calls/user/info 3) Run the codes below with token and tokenSecret obtained hard coded: JumblrClient client = new JumblrClient(consumerKey, consumerSecret); client.setToken(token, tokenSecret);
PhotoPost photoPost = client.newPost( "myblogname", PhotoPost.class ); photoPost.setId( 1232 ); photoPost.setPhoto( new Photo( "http://somedomain.com/somephoto.jpg" ) ); photoPost.setLinkUrl( "http://someotherdomain.com/1234" ); photoPost.setCaption( "Test Photo Title" ); photoPost.save(); // It is this line which throws an exception.
Would appreciate anybody could look into this. Thanks.