Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default flow results in error for missing installationId #578

Closed
1 task done
spew opened this issue Feb 23, 2024 · 5 comments · Fixed by #579
Closed
1 task done

Default flow results in error for missing installationId #578

spew opened this issue Feb 23, 2024 · 5 comments · Fixed by #579
Labels
released Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented, or is being fixed

Comments

@spew
Copy link

spew commented Feb 23, 2024

What happened?

The README.md gives the following code example for authenticating as an app.

const appOctokit = new Octokit({
  authStrategy: createAppAuth,
  auth: {
    appId: 1,
    privateKey: "-----BEGIN PRIVATE KEY-----\n...",
    clientId: "1234567890abcdef1234",
    clientSecret: "1234567890abcdef1234567890abcdef12345678",
  },
});

// Send requests as GitHub App
const { slug } = await appOctokit.request("GET /user");
console.log("authenticated as %s", slug);

If one tries to use this code (with valid values for the private key, client secret, etc), the following client-side error occurs:

installationId option is required for installation authentication

This means the library is unuseable without an app installation. If this is desired and correct behavior, then please adjust the README examples.

Versions

Octokit 3.1.2
Node v18.17.0

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@spew spew added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented, or is being fixed labels Feb 23, 2024
Copy link
Contributor

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@gr2m
Copy link
Contributor

gr2m commented Feb 23, 2024

It's /app, not /user. Try this instead

const { slug } = await appOctokit.request("GET /app");
console.log("authenticated as %s", slug);

@spew
Copy link
Author

spew commented Feb 23, 2024

Right, but the README says to use GET /user (Line 248: https://github.com/octokit/auth-app.js/blob/main/README.md?plain=1#L248).

The implication is that an app could make requests like, "list users" and things like that without having an installation. However, this is impossible.

@gr2m
Copy link
Contributor

gr2m commented Feb 23, 2024

Cheers! I'll get that fixed

@gr2m gr2m closed this as completed in #579 Feb 23, 2024
@github-project-automation github-project-automation bot moved this from 🆕 Triage to ✅ Done in 🧰 Octokit Active Feb 23, 2024
Copy link
Contributor

🎉 This issue has been resolved in version 6.0.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented, or is being fixed
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants