Skip to content

Commit 98638be

Browse files
committed
fix: octokit auth issue
1 parent 9873911 commit 98638be

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

README.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,26 @@
3434
> [!NOTE]
3535
> The OAuth app supports up to [15,000 requests per hour](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#primary-rate-limit-for-oauth-apps), significantly surpassing the [60 requests per hour](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#primary-rate-limit-for-unauthenticated-users) limit for unauthenticated requests. This increased capacity enables a higher volume of page views for your site.
3636
37-
3. You can customize the blog with environment variables. Here's an example:
37+
3. Create a personal access token.
38+
4. You can customize the blog with environment variables. Here's an example:
3839

3940
```
40-
GITHUB_CLIENT_ID="00000000000000000000"
41-
GITHUB_CLIENT_SECRET="0000000000000000000000000000000000000000"
41+
GITHUB_CLIENT_ID="your oauth app client id"
42+
GITHUB_CLIENT_SECRET="your oauth app client secret"
43+
GITHUB_TOKEN="your personal access token"
4244
AUTHOR_NAME="Daniel"
4345
BLOG_TITLE="Daniel's Blog"
4446
BLOG_DESCRIPTION="Hi, I'm Daniel, a software engineer from Taiwan. Welcome to my blog!"
4547
NEXT_PUBLIC_OWNER="m4xshen" (your GitHub username)
46-
NEXT_PUBLIC_REPO="example-blog" (the GitHub repository name that you want to store posts in)
48+
NEXT_PUBLIC_REPO="github-issue-blog" (the GitHub repository name that you want to store posts in)
4749
```
4850

4951
If you plan to deploy your site...
5052

5153
- with Vercel: [add environment variables in settings](https://vercel.com/docs/projects/environment-variables)
5254
- by yourself: copy above content to `.env.local`
5355

54-
4. Deploy the site and login to start blogging!
56+
5. Deploy the site and login to start blogging!
5557

5658
- with Vercel: [follow the docs](https://vercel.com/docs/deployments/overview)
5759
- by yourself: `yarn run build && yarn run start` and check out http://localhost:3000

environment.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ namespace NodeJS {
33
interface ProcessEnv {
44
GITHUB_CLIENT_ID: string;
55
GITHUB_CLIENT_SECRET: string;
6+
GITHUB_TOKEN: string;
67
AUTHOR_NAME: string;
78
BLOG_TITLE: string;
89
BLOG_DESCRIPTION: string;

src/utils/octokit.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { OAuthApp } from 'octokit';
1+
import { Octokit } from 'octokit';
22

3-
const { octokit } = new OAuthApp({
4-
clientType: 'oauth-app',
5-
clientId: process.env.GITHUB_CLIENT_ID,
6-
clientSecret: process.env.GITHUB_CLIENT_SECRET,
3+
const octokit = new Octokit({
4+
auth: process.env.GITHUB_TOKEN,
75
});
86

97
export default octokit;

0 commit comments

Comments
 (0)