authentication-strategies.js icon indicating copy to clipboard operation
authentication-strategies.js copied to clipboard

Getting “Integration not found” when using app id returned from /orgs/{org}/installations endpoint

Open rpivovar-godaddy opened this issue 3 years ago • 2 comments

If this is the wrong place to post this issue, happy to post this elsewhere --

I’m trying to instantiate Octokit with authStrategy createAppAuth with an app ID that I’ve retrieved by using the /orgs/{org}/installations endpoint. I used this endpoint by instantiating Octokit using a personal access token.

After listing installed apps, I could see the app in the returned JSON list that I wanted to use for the createAuthApp authStrategy. I copied its app ID from the app_id field.

I then went into the settings for the app and generated a brand new private key.

For testing purposes, I’ve stored my private key in my js file like this:

const privateKey = `
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
`.trim()

I then try to instantiate Octokit with the private key and the app ID.

const appOctokit = new Octokit({
  authStrategy: createAppAuth,
  auth: {
    appId: 1,
    baseUrl, // I'm using this same baseUrl when instantiating with personal access token
    privateKey
  }
});

Then I try to make a request to the /app endpoint with this new instance:

const { data } = await appOctokit.request('/app');
console.log(data);

I get this error, though: RequestError [HttpError]: Integration not found

After creating a private key for an app ID that appears to exist when using the /orgs/{org}/installations endpoint, it appears that I can’t find the app when instantiating with the createAppAuth helper.

Am I doing something wrong here?

Thanks for the help!

rpivovar-godaddy avatar Feb 17 '22 02:02 rpivovar-godaddy

I'm having the same issue and have no idea how to proceed further.

palmobar avatar Feb 24 '23 13:02 palmobar

@palmobar are you also setting baseUrl?

I would usually recommend to use the App SDK instead of Octokit + appAuth strategy.

gr2m avatar Feb 24 '23 18:02 gr2m