I'm trying to create a Github Repository via an NPM package Octokit. I've set up the necessary oAuth stuff, but keep getting the same error:
HttpError: [@octokit/auth-oauth-app] "POST /user/repos" does not support clientId/clientSecret basic authentication.
import { Injectable } from '@nestjs/common';
import { Octokit } from "@octokit/rest";
import { createOAuthAppAuth } from "@octokit/auth-oauth-app";
@Injectable()
export class AppService {
private auth() {
return createOAuthAppAuth({
clientType: "oauth-app",
clientId: "xxxxxxxxxxxxxxx",
clientSecret: "xxxxxxxxxxxxxxxxxxxxxxx",
});
};
public async create() {
const octokit = new Octokit({
authStrategy: createOAuthAppAuth,
auth: this.auth()
});
return await octokit.rest.repos.createForAuthenticatedUser({
name: `repoName/${new Date().toString()}`
}).then(({ data }) => { message: data });
}
}
I just needed to add a Personal Access Token rather than going to oAuth way.