Apple
Tinyauth에서 Apple 로그인 구성하기
Apple 로그인(Sign in with Apple)을 사용하면 사용자가 Apple ID로 tinyauth에 로그인할 수 있어요. 이 가이드는 Apple Developer에서 서비스를 등록하고 tinyauth에 연동하는 방법을 설명해요.
1. Apple Developer 설정
- Apple Developer에 접속하여 로그인해요.
- Certificates, Identifiers & Profiles로 이동해요.
- Identifiers에서 새로운 App ID를 등록해요. Sign in with Apple 기능을 활성화해요.
- Identifiers에서 새로운 Services ID를 등록해요:
- 이 Services ID의 Identifier가
client_id가 돼요. - Sign in with Apple을 활성화하고 Configure를 클릭해요.
- Domains and Subdomains에 도메인을 추가해요 (예:
auth.example.com). - Return URLs에 콜백 URL을 추가해요:
https://내_도메인.com/api/oauth/apple/callback
- 이 Services ID의 Identifier가
- Keys에서 새로운 키를 만들고 Sign in with Apple을 활성화해요. 다운로드한
.p8파일과 Key ID를 안전하게 보관해요.
Note
Apple 로그인의 client_secret은 JWT 형태로 생성해야 해요. Team ID, Key ID, 그리고 .p8 개인 키를 사용하여 생성할 수 있어요. 자세한 방법은 Apple 공식 문서를 참고해 주세요.
2. Tinyauth 설정
Apple Developer에서 준비한 자격증명을 config.yaml에 설정해요.
# config.yaml
identity_providers:
- id: apple
type: apple
enabled: true
client_id: com.example.auth
client_secret: ${APPLE_CLIENT_SECRET}
id: 이 제공자의 고유 식별자예요. 콜백 URL에 사용돼요.type:apple로 지정해요.client_id: Apple Developer에서 등록한 Services ID의 Identifier예요.client_secret: 생성한 JWT client secret이에요.
Caution
Apple은 기본적으로 form_post 응답 모드를 사용해요. tinyauth는 이를 자동으로 처리하므로 별도 설정이 필요 없어요. Apple은 사용자의 이름을 최초 로그인 시에만 제공하며, ID 토큰을 통해 사용자 정보를 전달해요.
예시
tinyauth를 https://auth.example.com에서 운영하는 경우의 전체 설정 예시예요.
# config.yaml
server:
public_origin: https://auth.example.com
identity_providers:
- id: apple
type: apple
enabled: true
client_id: com.example.auth
client_secret: eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9...
이 경우 Apple Developer의 Return URL은 다음과 같이 설정해야 해요.
https://auth.example.com/api/oauth/apple/callback