Skip to content

init with client secret but getting the Bad credentials - https://docs.github.com/rest #551

@helxsz

Description

@helxsz

my app is using "@octokit/rest": "^22.0.0", it used to work for some months, but last week I was getting the Bad credentials - https://docs.github.com/rest

Failed to fetch latest release: RequestError [HttpError]: Bad credentials - https://docs.github.com/rest
I thought the github token is expired, then I went to the developer page - https://github.com/settings/apps/test111 to generate a new client secret

but the credential error still exists

        let octokit = new Octokit({
                auth: process.env.GITHUB_TOKEN
            });

        async  getLatestRelease(owner:string, repo:string): Promise<ReleaseInfo | null> {
            try {
              const { data: release } = await octokit.rest.repos.getLatestRelease({
                owner: owner,
                repo: repo,
              });
          
              return {
                version: release.tag_name,
                releaseDate: new Date(release.published_at),
                releaseNotes: release.body || "",
                platforms: this.parseAssets(release.assets),
                isPrerelease: release.prerelease,
                downloadCount: release.assets.reduce(
                  (sum, asset) => sum + asset.download_count,
                  0
                ),
              };
            } catch (error) {
              console.error("Failed to fetch latest release:", error);
              return null;
            }
        }

        getLatestRelease('octokit', rest.js)

what is the error for this ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions