From 642cc035df9df60192fcc61b44bb7ccb62e1eed2 Mon Sep 17 00:00:00 2001 From: yonguk-k Date: Tue, 5 Nov 2024 17:12:41 +0900 Subject: [PATCH] Add Envs for Github Enterprise Oauth App --- backend/.env.development | 12 ++++++++++++ backend/src/auth/github.strategy.ts | 3 +++ 2 files changed, 15 insertions(+) diff --git a/backend/.env.development b/backend/.env.development index a05e2938..7eca2952 100644 --- a/backend/.env.development +++ b/backend/.env.development @@ -13,6 +13,18 @@ GITHUB_CLIENT_SECRET=your_github_client_secret_here # Format: https:///auth/login/github # Example: http://localhost:3000/auth/login/github (For development mode) GITHUB_CALLBACK_URL=http://localhost:3000/auth/login/github +# GITHUB_AUTHORIZATION_URL: Authorization URL for Github OAuth app. +# Default OAuth app is Github. Change this url for using Github Enterprise OAuth App. +# Format: https://ENTERPRISE_INSTANCE_URL/login/oauth/authorize +GITHUB_AUTHORIZATION_URL=https://github.com/login/oauth/authorize +# GITHUB_TOKEN_URL: Token URL for Github OAuth app. +# Default OAuth app is Github. Change this url for using Github Enterprise OAuth App. +# https://ENTERPRISE_INSTANCE_URL/login/oauth/access_token +GITHUB_TOKEN_URL=https://github.com/login/oauth/access_token +# GITHUB_USER_PROFILE_URL: User profile URL for Github OAuth app. +# Default OAuth app is Github. Change this url for using Github Enterprise OAuth App. +# https://ENTERPRISE_INSTANCE_URL/api/v3/user +GITHUB_USER_PROFILE_URL=https://api.github.com/user # JWT_ACCESS_TOKEN_SECRET: Secret key for signing and verifying access tokens. # JWT_ACCESS_TOKEN_EXPIRATION_TIME: Expiration time for access tokens in seconds. diff --git a/backend/src/auth/github.strategy.ts b/backend/src/auth/github.strategy.ts index e052c56e..0ef9bd0d 100644 --- a/backend/src/auth/github.strategy.ts +++ b/backend/src/auth/github.strategy.ts @@ -11,6 +11,9 @@ export class GithubStrategy extends PassportStrategy(Strategy, "github") { clientID: configService.get("GITHUB_CLIENT_ID"), clientSecret: configService.get("GITHUB_CLIENT_SECRET"), callbackURL: configService.get("GITHUB_CALLBACK_URL"), + authorizationURL: configService.get("GITHUB_AUTHORIZATION_URL"), + tokenURL: configService.get("GITHUB_TOKEN_URL"), + userProfileURL: configService.get("GITHUB_USER_PROFILE_URL"), scope: ["public_profile"], }); }