Announcement Announcement Module
No announcement yet.
Interacting with the ProviderAPI based on consumerKey in stead of user Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Interacting with the ProviderAPI based on consumerKey in stead of user


    One of the use cases I want to implement is the ability to tweet on the twitter account associated with the ConnectionFactory user. Basically tweeting with the server account in stead of the end user account.

    However, it's not entirely clear how to do this. Obviously, in this use case, there is no end user interaction. It all happens under the hood.

    Any suggestions?



  • #2
    Some providers allow you to obtain an access token associated with something other than a user. I don't believe Twitter allows for that, though.

    Commonly, I've seen this done by creating an app-specific Twitter user and using that user's access token/secret. In fact, when you register an app, you are granted a token/secret without even going through the OAuth dance (it's shown along with your app's registration info in Twitter's app details page). If you registered the app while signed in under your personal account, the token/secret is for you. But if you register the app while signed in under your app-specific Twitter user, that token will then be good for tweeting as that app-specific user.

    Once you have the token/secret in hand, you can simply create a TwitterTemplate with it. You could also add an entry in the connection repository for the app-specific user and use the UsersConnectionRepository to get the ConnectionRepository for that user and from that get the connection and API binding--but that seems a bit much to handle connections for a pseudo-user like that.