春季社交推特MissingAuthorizationException [英] spring social twitter MissingAuthorizationException
本文介绍了春季社交推特MissingAuthorizationException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试按照本教程中的描述使用Spring Social发布一条推文:
I tried to post a tweet using Spring Social as described in this tutorial: https://docs.spring.io/spring-social-twitter/docs/current/reference/htmlsingle/. However I am getting
org.springframework.social.MissingAuthorizationException: Authorization is required for the operation, but the API binding was created without authorization.
我的代码如下
TwitterTemplate twitterTemplate = new TwitterTemplate("key", "secret");
TweetData tweetData =new TweetData("test screenshot").withMedia(new ByteArrayResource(object.getScreenshot().getBytes()));
Tweet postResult = twitterTemplate.timelineOperations().updateStatus(tweetData);
推荐答案
某些操作需要将单独的访问令牌与TwitterTemplate一起传递:
certain operations require a separate access token to be passed along with TwitterTemplate:
new TwitterTemplate(consumerKey, consumerSecret, accessToken, accessTokenSecret);
访问令牌可以在此处生成:apps.twitter.com/app/"appId"/keys
access tokens can be generated here: apps.twitter.com/app/"appId"/keys
这篇关于春季社交推特MissingAuthorizationException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文