Élodie Petit
Élodie Petit

Reputation: 5914

Pulling tweets of a protected account

I need to pull the tweets of a protected account and show them on an intranet portal. I think I need to use an account that is authorized by the protected account and pull the tweets with that account but as far as I know, basic authentication is not supported anymore. So, can someone put me in the right direction?

Thank you.

Upvotes: 0

Views: 2972

Answers (1)

air-dex
air-dex

Reputation: 4180

Your idea sounds feasible. Your portal could display publicly the timeline of an account which follows protected accounts. However ensure that it does not violate Twitter policies.

So you will have to do this :

  1. Create the account for the portal. Let's call it "@portal_account".
  2. Ensure that the account which protects its tweets (let's call it "@protected_account") allows @portal_account to see its tweets.
  3. Create a Twitter application to see the timeline. Let's call it "Portal_app". For this, go to Twitter Developers, the Twitter site dedicated to Twitter development. Sign in with the application owner Twitter Credentials (Twitter Developers uses Twitter username and password to sign in). Once you did it, create a new application here. Give it a name ("Portal_app"), a description, an URL and a callback URL (used for authorizing Portal_app to use @portal_account's account). For security reasons, give to Portal_app a read only access to user's accounts. Once the application is created you can access to its settings via its owner's Twitter (Developers) account. For this, go here and click on the application name.
  4. Authentication time ! Twitter do not use basic authentication any longer but OAuth. OAuth consists in making a service (here Twitter) user (here @portal_account) authorize a third party entity (here the "Portal_app" Twitter application) to use its account to the service without giving to third party entity its service credentials (username and password). On Twitter, this authorization consists in two tokens - a "public" token and a secret token - which are used for authenticating requests to Twitter. So what you have to do here is obtaining the two tokens symbolizing @portal_account's authorization to Portal_app to use its account. Note that if @portal_account is the owner of Portal_app, you will be able to generate the tokens from the application settings. Otherwise you will have to create a special program to obtain the tokens. See the corresponding pages in Twitter Developers documentation for this.
  5. Use @portal_account account and Portal_app to display the tweets you want to display. For this, you can use the Twitter REST API. You get endpoints for displaying a particular tweet, @portal_account's timeline, other users (with @protected_account among them) timeline.

If you want further details about Twitter development and API, refer to the Twitter Developers Documentation. It is your friend for stuff related to Twitter and it is quite complete.

Upvotes: 1

Related Questions