콘텐츠로 이동

기타

tinyauth에서 기본 지원하지 않는 OAuth/OIDC 제공자도 generic_oauth 유형을 통해 연동할 수 있어요. 커스텀 엔드포인트와 필드 매핑을 직접 지정하는 방식이에요.

config.yaml
identity_providers:
- id: my-provider
type: generic_oauth
enabled: true
display_name: My Provider
icon_url: https://example.com/icon.png
client_id: ${MY_PROVIDER_CLIENT_ID}
client_secret: ${MY_PROVIDER_CLIENT_SECRET}
authorization_url: https://provider.com/oauth/authorize
token_url: https://provider.com/oauth/token
userinfo_url: https://provider.com/oauth/userinfo
scopes:
- openid
- email
- profile
userinfo_mapping:
id: sub
email: email
email_verified: email_verified
name: name
picture: picture

공통 설정 항목에 추가로, generic_oauth 유형에서는 다음 항목을 지정해야 해요.

항목필수설명
display_nameO로그인 버튼에 표시될 제공자 이름이에요.
authorization_urlOOAuth 인증 엔드포인트 URL이에요.
token_urlO토큰 교환 엔드포인트 URL이에요.
userinfo_urlX사용자 정보 엔드포인트 URL이에요. ID 토큰에서 사용자 정보를 가져오는 경우 생략할 수 있어요.
email_urlX이메일 정보를 별도로 가져와야 하는 경우의 엔드포인트 URL이에요 (GitHub처럼 이메일 API가 분리된 경우).
scopesO요청할 OAuth 스코프 목록이에요.
response_modeXOAuth 응답 모드예요. query, fragment, form_post 중 하나를 지정할 수 있어요.

사용자 정보 매핑 (userinfo_mapping)

섹션 제목: “사용자 정보 매핑 (userinfo_mapping)”

OAuth 제공자마다 사용자 정보 응답의 필드 이름이 달라요. userinfo_mapping을 통해 tinyauth가 어떤 필드에서 어떤 정보를 가져올지 지정해요.

항목필수설명
idO사용자 고유 ID 필드 이름이에요. (예: sub, id, user_id)
emailO이메일 필드 이름이에요. (예: email, mail)
email_verifiedX이메일 인증 여부 필드 이름이에요. (예: email_verified, verified)
nameX사용자 이름 필드 이름이에요. (예: name, display_name)
pictureX프로필 이미지 URL 필드 이름이에요. (예: picture, avatar_url)

Kakao OAuth를 연동하는 예시예요.

config.yaml
identity_providers:
- id: kakao
type: generic_oauth
enabled: true
display_name: Kakao
icon_url: https://example.com/kakao-icon.png
client_id: ${KAKAO_CLIENT_ID}
client_secret: ${KAKAO_CLIENT_SECRET}
authorization_url: https://kauth.kakao.com/oauth/authorize
token_url: https://kauth.kakao.com/oauth/token
userinfo_url: https://kapi.kakao.com/v2/user/me
scopes:
- openid
- account_email
- profile_nickname
userinfo_mapping:
id: id
email: kakao_account.email
name: kakao_account.profile.nickname
picture: kakao_account.profile.profile_image_url

GitLab(자체 호스팅 포함) OAuth를 연동하는 예시예요.

config.yaml
identity_providers:
- id: gitlab
type: generic_oauth
enabled: true
display_name: GitLab
client_id: ${GITLAB_CLIENT_ID}
client_secret: ${GITLAB_CLIENT_SECRET}
authorization_url: https://gitlab.com/oauth/authorize
token_url: https://gitlab.com/oauth/token
userinfo_url: https://gitlab.com/oauth/userinfo
scopes:
- openid
- email
- profile
userinfo_mapping:
id: sub
email: email
email_verified: email_verified
name: name
picture: picture