Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting org.springframework.social.NotAuthorizedException: Invalid or expired token Error #2

Open
Ecomse opened this issue Jun 27, 2016 · 3 comments

Comments

@Ecomse
Copy link

Ecomse commented Jun 27, 2016

Hi

Using the exact code and i am getting below exception for Twitter Status update/springSocialCallback in TwitterController Class

@ line : timelineOperations.updateStatus("Hello Twitter Social plugin!");

exception:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.social.NotAuthorizedException: Invalid or expired token.
root cause:

org.springframework.social.NotAuthorizedException: Invalid or expired token.
    org.springframework.social.twitter.api.impl.TwitterErrorHandler.handleClientErrors(TwitterErrorHandler.java:103)
    org.springframework.social.twitter.api.impl.TwitterErrorHandler.handleError(TwitterErrorHandler.java:60)
    org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:537)
    org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:493)
    org.springframework.web.client.RestTemplate.execute(RestTemplate.java:465)
    org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:236)
    org.springframework.social.twitter.api.impl.TimelineTemplate.getFavorites(TimelineTemplate.java:220)
    org.springframework.social.twitter.api.impl.TimelineTemplate.getFavorites(TimelineTemplate.java:212)

And also below is printing "false"
System.out.println("isAuthorized :: " + twitterTemplate.isAuthorized());

Can u plz do the needful help ?

Regards
Ecomse

@arpitaggarwal
Copy link
Owner

Login to Twitter and create your apikey, apisecret, accessToken,accessTokenSecret and replace the same in application.properties.

@Ecomse
Copy link
Author

Ecomse commented Jun 27, 2016

Hi Arpit, already done that in https://apps.twitter.com/app/ and replaced above keys.

I am Suspecting this line : TwitterTemplate twitterTemplate = new TwitterTemplate(oauthToken);
As per code debug, to do any operations on timelineOperations, we need authorozation and its coming false now.

Regards
Ecomse

@Ecomse
Copy link
Author

Ecomse commented Jun 30, 2016

Hi Arpit

Have you got any chance to look into this issue?

Regards
Ecomse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants