title: Authentication of a Github App with @octokit
body: <p>I use <code>@octokit/rest</code> to access github and try to authenticate with the <code>authenticate()</code> function.</p>
  
  <pre><code>const credentials = { type: 'oauth', key: process.env.GITHUB_ID, secret: process.env.GITHUB_SECRET }
  octokit.authenticate(credentials)
  </code></pre>
  
  <p>I've got the credentials from the settings page of my github app (OAuth credentials, at the bottom of the page) and I've checked that they are set correctly in the environment of the process.</p>
  
  <p><a href="https://www.npmjs.com/package/@octokit/rest#authentication" rel="nofollow noreferrer">https://www.npmjs.com/package/@octokit/rest#authentication</a> says, that authenticate is synchronuous because it only sets the credentials for the following requests, so I don't use <code>await</code> here.</p>
  
  <p>This seem to work, at least, it doesn't throw any errors.</p>
  
  <p>My code to create the check run:</p>
  
  <pre><code>octokit.checks.create({...})
  </code></pre>
  
  <p>But when running this code, I get the error</p>
  
  <pre><code>{ HttpError: {"message":"You must authenticate via a GitHub App.","documentation_url":"https://developer.github.com/v3/checks/runs/#create-a-check-run "}
    at response.text.then.message (/usr/app/node_modules/@octokit/rest/lib/request/request.js:72:19)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  </code></pre>
  
  <p>--
  If I instead generate a JWT token and authenticate like this:
      const credentials = { type: 'oauth', token: process.env.GITHUB_TOKEN }</p>
  
  <p>with the JWT like
      <code>eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MzUxMTEwNzcsImV4cCI6MTUzNTExMTY3NywiaXNzIjoiSXYxLjAwNjhkZjdkYzRmNjNkMGIifQ.KHb1V3Fh6WKLAlcZkQPntVehvl1frp3rdBT9-lOTJRzAx8JxGyxpEUnOdwbNU3gmx_G1Fu3E3QEbcCWs0L743HkJ4B53JQpni1cQ1YZ25e0HH3OO6HW4WycaYbgGPcZRZCDe0vocwaxKjHq16uG7jsfVLC4lR94GVxJQhu-w9WX9BVxE3x_yqKdMhFYhKvez8oBpAXRZFQbKtw2rb8TXHV3-PKXTRCfO_fR_Omr7J3Mw26yHdnoRK1pA7BS5O1P0UAFmWshLted2UbE0S8SU0ZoUnZE0QA3wW-o4Q4-6oEGCK9UWLnnHAfn11Ow7rKulSUyCvZgKV8niGSL7R97nWg</code></p>
  
  <p>I get the following response:</p>
  
  <p><code>{"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}</code></p>