Search code examples
etlapache-nifigithub-api

Access GitHub API from Nifi


I'm trying to access info within GitHub's API from a NiFi Process. Essentially, I'm using GenerateFlowFile to set the target URL and the Authorization header for the token. I then pass it to the InvokeHTTP and every time it gets a 401 error saying it needs to be authenticated, despite providing my personal token (the one I use when programming locally and with Terminal). Any tips on how I can get this working? I can provide more detail if needed

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here


Solution

  • I'm not sure which endpoint you're trying to access in the GitHub API, but it appears you are using an endpoint from GitHub Enterprise 2.22 from the error message.

    The docs for authentication show you should prefix the token with token i.e:

    Authorization: token OAUTH-TOKEN
    

    In your specific case, this means you should set the Authorization header to token ${github_token}.