Search code examples
javagrailsgroovytwitter

Consuming and OAuth2 secured API in Grails (Twitter)


I am trying to fetch some tweets from twitter using Grails. The twitter API now requires authentication via OAuth2 which I have done before in other frameworks and languages quite easily with some plugins/libraries however I cannot seem to find a working implementation in Grails. Most google searches seem to turn up results relating to using OAuth to authenticate users as the server where as I am trying to have Grails instead act as the client.

This plugin looked promising, however the repo for it appears to be broken as the following links to the binaries result in a 404.

https://repo.grails.org/grails/core/org/grails/plugins/twitter/0.2.4/twitter-0.2.4.pom https://repo.grails.org/grails/core/org/grails/plugins/twitter/0.2.4/twitter-0.2.4.jar

Does anyone have a working implimentation for doing this?


Solution

  • Turns out the read me for the twitter plugin is incorrect and the plugin name should be twitter-service in the build.gradle ie:

    compile "org.grails.plugins:twitter-service:0.2.4"
    

    For those attempting to do a similar thing you may also have success with the java twitter4j library.