Set up Authentication

The connector supports both HTTP basic authentication (using a GitHub personal access token) and OAuth authentication.

Basic Authentication

To configure Basic authentication

  1. Open your GitHub settings page (click your profile icon, followed by Settings).
  2. Click Developer Settings.
  3. Click Personal Access Tokens.
  4. Click Generate new token.
  5. Select the repo scope.
  6. Click Generate token.

    The token is generated. When you configure the connector, set the parameter BasicUsername to your user name, and BasicPassword to the token. For information about creating a fetch task, see Retrieve Information from GitHub.

OAuth Authentication

To authenticate using OAuth, you must create a GitHub OAuth application to represent the connector, and then run the OAuth configuration tool.

To configure OAuth authentication

  1. Open your GitHub settings page (click your profile icon, followed by Settings).
  2. Click Developer Settings.
  3. Click OAuth Apps.
  4. Click Register a new application.
  5. Type a name for the new application.
  6. Enter a callback URL (sometimes called a redirect URL).

    • To use the NiFi Ingest connector, 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).
    • To use the standard connector, the redirect URL must match the value of the RedirectUrl parameter in the OAuth tool configuration file, oauth_tool.cfg. The default value is http://localhost:7878/.
  7. Click Register Application.

    The OAuth application is created. Make a note of the client ID and client secret.

  8. Run the OAuth configuration tool to configure the connector.

    • To configure the NiFi Ingest connector

      1. In the NiFi web interface, right-click the processor and click Configure.
      2. Click ADVANCED, and complete the guided setup wizard.
      3. Click the OAUTH SETUP tab.
      4. Enter your AppKey and AppSecret (client ID and client secret).
      5. Specify the proxy server to use, if you need to use one to access GitHub.
      6. Click SUBMIT.

        A new tab opens in your web browser, and the GitHub web site is displayed.

      7. Log in to GitHub and authorize the connector to access your data.
    • To configure the standard connector

      1. Open the folder where you installed the connector.
      2. Open the file oauth_tool.cfg in a text editor.
      3. In the [Default] section, set any SSL or proxy settings that are required to access the repository:

        SSLMethod The version of SSL/TLS to use.
        ProxyHost The host name or IP address of the proxy server to use.
        ProxyPort The port of the proxy server to use.

        For example:

        SSLMethod=NEGOTIATE
        ProxyHost=10.0.0.1
        ProxyPort=8080
      4. In the [OAuthTool] section, set the following parameters:

        AppKey The client ID that you obtained by creating the OAuth application.
        AppSecret The client secret that you obtained by creating the OAuth application.
      5. Open a command-line window and run the following command:

        oauth_tool.exe oauth_tool.cfg OAuthTool

        Your default web browser opens to the GitHub web site.

      6. Log in to GitHub and grant consent for the connector to access your data.

        The web page displays a message stating that the OAuth details have been successfully stored, and the OAuth tool creates the files oauth.cfg and oauth2_sites.bin. When you configure the connector, import the parameters from oauth.cfg into your task configuration. For more information about including parameters from another file, see Include an External Configuration File. For information about configuring a fetch task, see Retrieve Information from GitHub.