Skip to content

Commit

Permalink
feat: fix scope (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
njfamirm authored Jan 10, 2025
2 parents 9f82470 + 2ae80e3 commit a2fa589
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"contributors": [
"S. Amir Mohammad Najafi <[email protected]> (njfamirm.ir"
],
"version": "1.0.0",
"version": "1.1.0",
"license": "MIT",
"private": true,
"type": "module",
Expand Down
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createLogger } from "@alwatr/logger";

const clientId = process.env.OAUTH_GITHUB_CLIENT_ID
const clientSecret = process.env.OAUTH_GITHUB_CLIENT_SECRET
const scope = process.env.OAUTH_GITHUB_SCOPE

if (clientId == undefined) {
throw new Error('github client id required, OAUTH_GITHUB_CLIENT_ID="123_123_123" yarn start');
Expand All @@ -15,6 +16,7 @@ export const config = {
id: clientId as string,
secret: clientSecret as string,
},
scope: scope || 'repo',
auth: {
tokenHost: 'https://github.com',
tokenPath: '/login/oauth/access_token',
Expand Down
2 changes: 1 addition & 1 deletion src/route/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ nanoServer.route('GET', '/auth', (connection) => {

const authorizationUri = client.authorizeURL({
redirect_uri: `https://${host}/callback?provider=${provider}`,
scope: 'repo,user',
scope: config.scope,
state: randomString(),
});

Expand Down

0 comments on commit a2fa589

Please sign in to comment.