Configure OAuth Authentication

To ingest content from Twitter, you must create a Twitter OAuth application to represent the connector.

Twitter Connector supports the following types of OAuth authentication:

OAuth 1.0 (3-legged OAuth) is also supported, but only by the NiFi Ingest connector.

The following table suggests an appropriate authentication method based on the Twitter API that you want to use.

Twitter API Suggested authentication method
V2 Filtered Stream OAuth 2.0 "Service Account"
V2 Sampled Stream OAuth 2.0 "Service Account"
V2 Search (recent) OAuth 1.0
V2 Search (full archive) OAuth 2.0 "Service Account"
V2 User Timeline OAuth 1.0
V1.1 Premium Search OAuth 2.0 "Service Account"

To create an OAuth application

  1. Go to https://developer.twitter.com/en/portal/projects-and-apps.
  2. Create a new app.

    NOTE: To use the Twitter version 2 API, you must create an app within a project, or create a standalone app and then add it to a project. A standalone app can use only the Twitter version 1.1 APIs.

    1. Click Create App.
    2. Type a name for the new app and click Next.
    3. Make a note of the API key, the API secret key, and the bearer token.
  3. Click App Settings.

    'Read Only' permission (the default) is sufficient for the connector.

  4. (OAuth 1.0 only) Choose whether to use 3-legged OAuth. This allows the connector to obtain the access token and access token secret but is supported only by the NiFi Ingest connector. If you want to use the standard connector, or do not enable 3-legged OAuth, then you must provide the access token and access token secret when you configure the connector.

    • To use 3-legged OAuth (NiFi connector only)

      1. In the Authentication settings area, click Edit.
      2. Enable 3-legged OAuth.
      3. In the Callback URLs box, type your redirect URL.

        TIP: The redirect URL must match the URL shown in the advanced configuration dialog of the NiFi processor. (In the NiFi web interface, right-click the processor and click Configure. Then click ADVANCED. You can find the redirect URL on the OAUTH SETUP tab).

      4. Click Save.
    • To obtain an access token and secret

      1. Click the Keys and tokens tab.
      2. Next to "Access token and Secret", click Generate and make a note of the values.

After creating the OAuth application you can configure the connector.

To configure the connector

For information about how to set up a task to retrieve data from Twitter, see the following topics: