기존 OpenAPI의 Body 기반 인증 방식은 보안상 한계가 있어, 👉 1회성 Access Token 발급 후 API 호출 시 헤더에 포함하는 방식으로 개선되었습니다.
발급받은 Access Token은 다우오피스 OpenAPI 호출 시 다음과 같이 사용합니다.
Authorization: Bearer {ACCESS_TOKEN}
- 위치 : OpenAPI > 인증키 연동 > 인증 Token 발행
- 대상 : 모든 OpenAPI 공통 (근태/연차 API 포함)
- 비고 : 기존 인증 방식도 하위호환을 위해 유지되며, 순차적으로 Token 기반으로 전환 예정
✔️ Request URL
https://api.daouoffice.com/public/auth/v1/oauth2/token
해당 API는 다우오피스 OpenAPI Request URL(api.daouoffice.com)을 사용합니다.
✉️ Request Body
Header
| 변수 | 타입 | 필수 | 사전발급 | 설명 |
|---|---|---|---|---|
| Authorization | String | ✅ | ✅ | RFC 6749 표준의 Basic 인증 방식 사용. client_id와 client_secret을 :로 연결 후 Base64 인코딩하여 Authorization 헤더에 포함. 예) Authorization: Basic bXlfY2xpZW50X2lkOm15X2NsaWVudF9zZWNyZXQ= |
Parameter
| 변수 | 타입 | 필수 | 사전발급 | 설명 |
|---|---|---|---|---|
| grant_type | String | ✅ | ⛔ | 고정값 client_credentials 사용 |
✉️ Request 예시
POST https://api.daouoffice.com/public/auth/v1/oauth2/token
Authorization : Basic Y2xpZW50SWQ6Y2xpZW50U2VjcmV0
Content-Type : application/x-www-form-urlencoded
grant_type=client_credentials
Authorization : Basic Y2xpZW50SWQ6Y2xpZW50U2VjcmV0
Content-Type : application/x-www-form-urlencoded
grant_type=client_credentials
📬 Response Body
성공 시
| 변수 | 타입 | 필수 | 사전발급 | 설명 |
|---|---|---|---|---|
| token_type | String | ✅ | ⛔ | 토큰 타입, DOAS에서는 bearer 고정 |
| expires_in | String | ✅ | ⛔ | 토큰 유효기간(초 단위), 현재 1일(86400초) |
| access_token | String | ✅ | ⛔ | Access Token, DOAS API 호출 시 Authorization 헤더에 포함 |
실패 시
| 변수 | 타입 | 필수 | 사전발급 | 설명 |
|---|---|---|---|---|
| code | String | ✅ | ⛔ | 오류 코드 |
| message | String | ✅ | ⛔ | 오류 유형 |
| messageDetail | String | ⛔ | ⛔ | 오류 상세 설명 |
📬 Response 예시
성공
json
{
"token_type" : "bearer",
"expires_in" : 86400,
"access_token" : "eyJhbGciOiJIUzI1NiJ9...",
"expires_in" : 86400,
"access_token" : "eyJhbGciOiJIUzI1NiJ9...",
}
실패
json
{
"code" : "401",
"message" : "invalid_client",
"messageDetail" : "연동ID(clientId)를 확인하세요"
"message" : "invalid_client",
"messageDetail" : "연동ID(clientId)를 확인하세요"
}
🚫 주요 오류 코드 예시
| 코드 | 내용 | 설명(Description) |
|---|---|---|
| 400 | 필수 파라미터 누락 | 연동ID(client id)가 누락되었습니다. 연동비밀키(client secret)가 누락되었습니다. grant type이 누락되었습니다. |
| 400 | 지원되지 않는 타입 | 지원되지 않는 grant type 입니다. |
| 401 | 유효하지 않은 client ID, Client Secret | 연동 ID(client ID)를 확인하세요. 연동 비밀키(client Secret)를 확인하세요. |