콘텐츠로 이동

GitHub

GitHub OAuth를 사용하면 사용자가 GitHub 계정으로 tinyauth에 로그인할 수 있어요. 이 가이드는 GitHub에서 OAuth App을 만들고 tinyauth에 연동하는 방법을 설명해요.


  1. GitHub Developer Settings에 접속해요.
  2. OAuth Apps > New OAuth App을 클릭해요.
  3. 다음 정보를 입력해요:
    • Application name: 사용자에게 표시될 앱 이름
    • Homepage URL: https://내_도메인.com
    • Authorization callback URL:
      https://내_도메인.com/api/oauth/github/callback
  4. Register application을 클릭해요.
  5. 생성된 앱 페이지에서 Client ID를 확인하고, Generate a new client secret을 클릭하여 Client Secret을 생성해요. 이 값을 안전하게 보관해요.

GitHub에서 발급받은 자격증명을 config.yaml에 설정해요.

config.yaml
identity_providers:
- id: github
type: github
enabled: true
client_id: ${GITHUB_CLIENT_ID}
client_secret: ${GITHUB_CLIENT_SECRET}
  • id: 이 제공자의 고유 식별자예요. 콜백 URL에 사용돼요.
  • type: github로 지정해요.
  • client_id: GitHub에서 발급받은 Client ID예요.
  • client_secret: GitHub에서 발급받은 Client Secret이에요.

tinyauthhttps://auth.example.com에서 운영하는 경우의 전체 설정 예시예요.

config.yaml
server:
public_origin: https://auth.example.com
identity_providers:
- id: github
type: github
enabled: true
client_id: Iv1.a1b2c3d4e5f6g7h8
client_secret: abcdef1234567890abcdef1234567890abcdef12

이 경우 GitHub OAuth App의 Authorization callback URL은 다음과 같이 설정해야 해요.

https://auth.example.com/api/oauth/github/callback