Skip to content

[BUG]: secretOrPrivateKey must be an asymmetric key when using RS256 #465

@tbranyen

Description

@tbranyen

What happened?

Generated a privatekey using the GitHub Apps interface, which downloaded a .pem file. I loaded this file directly into my auth config:

    auth: {
        privateKey: require('fs').readFileSync('./my-key.pem').toString(),
        appId: 12345,
        installationId: 67890
    },

I also tried pasting in the key directly. I also removed all whitespace in a separate attempt. All yielded the same error, which seems to me indicates a problem with the keys being generated from GitHub. Would appreciate any assistance with this.

Relevant error is shown in the log output below.

Versions

    "node_modules/@octokit/auth-app": {
      "version": "4.0.9",
    "node_modules/octokit": {
      "version": "2.0.14",

Relevant log output

/home/tim/website/node_modules/jsonwebtoken/sign.js:124
      return failure(new Error((`secretOrPrivateKey must be an asymmetric key when using ${header.alg}`)))
                     ^
Error: secretOrPrivateKey must be an asymmetric key when using RS256
    at Object.sign (/home/tim/website/node_modules/jsonwebtoken/sign.js:124:22)
    at getToken (/home/tim/website/node_modules/universal-github-app-jwt/dist-src/get-token.js:3:25)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Needs infoFull requirements are not yet known, so implementation should not be startedStatus: Up for grabsIssues that are ready to be worked on by anyoneType: BugSomething isn't working as documented, or is being fixed

    Type

    No type

    Projects

    Status

    🔥 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions