java - Springboot Twitter Binding API Authorization -
i want make springboot application can connect twitter through api using secret , client key. here code
package com.backend.siap.controller; import java.util.list; import org.springframework.beans.factory.annotation.autowired; import org.springframework.http.mediatype; import org.springframework.social.twitter.api.tweet; import org.springframework.social.twitter.api.twitter; import org.springframework.web.bind.annotation.pathvariable; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.restcontroller; @restcontroller public class testtwitter { @autowired private twitter twitter; @requestmapping(value="twitter/{hashtag}", produces = mediatype.application_json_utf8_value) public list<tweet> gettweets (@pathvariable final string hashtag) { return twitter.searchoperations().search(hashtag, 5).gettweets(); } @requestmapping(value="timeline", produces = mediatype.application_json_utf8_value) public list<tweet> gettimeline() { return twitter.timelineoperations().gethometimeline(); } }
if call gettweet method controller return json contain tweet search using hashtag. work
but if call gettimeline method controller return this
org.springframework.social.missingauthorizationexception: authorization required operation, api binding created without authorization.
i have added secret , client code in application properties.
how solve problem? thanks
Comments
Post a Comment