로그인 및 인증 기능
User Account Connect API를 사용하면, DOSI 사용자가 파트너사 서비스에 DOSI 계정으로 로그인할 수 있습니다.
연결 정보
개발 환경 | API base URI |
---|---|
운영 환경 | https://api.dosi.world |
사용 절차
DOSI 사용자가 파트너사 서비스에 로그인하게 하거나 사용자 정보를 가져오려면 다음 절차를 따라야 합니다.
Google 계정으로 DOSI에 로그인하려면 Gmail 계정을 사용해야 합니다. Google Workspace 계정은 사용할 수 없습니다.
1. DOSI 사용자 인증 요청
Authorization endpoint(https://members.dosi.world
)로 인증 요청을 보내세요. 이때 아래의 서비스 정보를 쿼리 파라미터로 전달해야 합니다.
파라미터 | 설명 |
---|---|
client_id | DOSI SDK 사용 신청 후에 받은 DOSI 채널 ID |
state | OAuth Flow 검증용 임의 문자열 |
mode | OAuth Flow 모드. 항상 "oauth" 입력. |
redirect_uri | 사용자 로그인 후 돌아갈 URI |
scope | 제공받을 사용자 프로필 정보 그룹. 항상 "basic" 입력. |
code_challenge | PKCE의 code challenge 값. 클라이언트가 모바일 앱일 때는 반드시 입력해야 합니다. |
code_challenge_method | PKCE에서 code_challenge 생성 방법. 클라이언트가 모바일 앱이면 반드시 입력해야 하며, 값은 항상 "S256"입니다. |
아래는 호출 예시입니다.
https://members.dosi.world?client_id=17XEvciBbskwvvddn0m_&state=hiubweiriuqukjdsfsdrwe&mode=oauth&redirect_uri=https%3A%2F%2Fprofile.dosi.world%2F
DOSI는 이 요청을 받으면 서비스 연결 승인 화면(로그인하지 않았다면 로그인 화면)을 보여줍니다. 사용자가 이 화면에서 작업을 승인하면, DOSI는 redirect_uri
로 인증 코드(authorization code)를 발급합니다.
2. 액세스 토큰 처리
1번 작업 완료 후 발급받은 인증 코드로 액세스 토큰(access token)을 발급하세요. 액세스 토큰 발급 또는 갱신 엔드포인트로 요청할 수 있습니다.
3. 사용자 프로필 획득
2번 작업 후 발급받은 액세스 토큰으로 사용자 프로필을 가져오세요. 사용자 확장 프로필 조회 엔드포인트로 프로필을 요청할 수 있습니다.
액세스 토큰 발급 또는 갱신
인증 코드(authorization code)로 액세스 토큰(access token)을 발급하거나 리프레시 토큰(refresh token)으로 액세스 토큰을 갱신합니다.
Path
None
Query
None
Body
Name | Type | Description | Required |
---|---|---|---|
grant_type | string | 요청 유형. 아래 중 하나를 입력하세요.
| |
code | string | 액세스 토큰을 발급할 사용자의 인증 코드. | |
client_id | string | DOSI SDK 사용 신청 후에 받은 DOSI 채널 ID | |
client_secret | string | DOSI SDK 사용 신청 후에 받은 DOSI 채널 시크릿 | |
refresh_token | string | 액세스 토큰을 갱신할 리프레시 토큰.
| |
code_verifier | string | PKCE에서 클라이언트가 스스로를 인증할 용도로 생성한 랜덤 문자열. 엔트로피가 높은 랜덤 값을 입력해야 합니다. 참고 문서를 확인하세요.
|
- Content-Type: application/x-www-form-urlencoded
Request examples
curl -v -X POST "https://api.dosi.world/api/v1/oauth2/token" \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=authorization_code' \
-d 'code=b5fd32eacc791df' \
-d 'client_id=12345' \
-d 'client_secret=d6524edacc8742aeedf98f'
액세스 토큰 폐기
발급받은 액세스 토큰(access token)과 리프레시 토큰(refresh token)을 폐기합니다.
Path
None
Query
None
Body
None
- Authorization: Bearer <access token>
- Content-Type: application/json
Request examples
curl -v -X POST "https://api.dosi.world/api/v1/oauth2/revoke" \
--header 'Authorization: Bearer <access token>' \
--header 'Content-Type: application/json'
사용자 확장 프로필 조회
액세스 토큰을 이용해 사용자의 확장 프로필(extended profile)을 가져옵니다.
Path
None
Query
None
Body
None
- Authorization: Bearer <access token>
- Content-Type: application/json
Request examples
curl -v -X GET "https://api.dosi.world/api/v2/profile/extended" \
--header 'Authorization: Bearer <access token>' \
--header 'Content-Type: application/json'