Announcement Announcement Module
Collapse
No announcement yet.
Failed when creating an instance of TwitterTemplate Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Failed when creating an instance of TwitterTemplate

    Hi all, I want to ask about twitter..

    I've successfully login to twitter using spring-social-1.0.0.M2.
    When i'm open twitter's website, i've login to twitter..
    but when i'm want to creating an instance of TwitterTemplate, i've got error..

    Here is my code :
    Code:
    @RequestMapping(value = "/memberAreaTwitter", method = RequestMethod.GET)
    public void prepareMemberAreaTwitter(@RequestParam(value = "oauth_verifier", defaultValue = "verifier") String verifier,HttpSession session, Model model, HttpServletRequest request)
        {
            Token requestToken = (Token)session.getAttribute("twitter_request_token");
            try
            {
                Token accessToken = loginTwitterHelper.getOAuthService().getAccessToken(requestToken, new Verifier(verifier));
                System.out.println(accessToken.getToken());
                System.out.println(accessToken.getSecret());
                TwitterTemplate twitter = new TwitterTemplate("xxx", "xxx", accessToken.getToken(), accessToken.getSecret());            //error in here
                System.out.println("success ");          
            }
            catch(Throwable e)
            {
                System.out.println("error = " + e.getMessage());
            }
        }
    error which appear in my log was : error = org/springframework/social/SocialException

    what should i do to creating an instance of TwitterTemplate..
    in spring's reference.pdf, to create an instance of twitter template, the code is :
    Code:
    TwitterOperations twitter = new TwitterTemplate(apiKey, apiSecret, accessToken, accessTokenSecret
    but class TwitterOperations wasn't exists..

    thx before...

  • #2
    I would highly recommend upgrading to the latest 1.0.0.BUILD-SNAPSHOT, which is basically 1.0.0.RC1 due out later this week, and using the Samples, Reference Docs, and Quickstart as guides. You're not going to get much support working with an older milestone. Also, looking at the code above, it seems you're duplicating quite a lot in ConnectController/ProviderSignInController, much of which has now been generalized in a ConnectSupport class in spring-social-web. I wouldn't recommend doing that unless you have good reason to.

    Hope this helps,

    Keith

    Comment

    Working...
    X