Skip to main content

애플리케이션 인증

이 문서는 사용자 계정 없이 애플리케이션 자격으로 인증 후 토큰을 발급 받는 방법을 설명합니다.

이해하기

note

애플리케이션 인증 방식의 토큰 발급을 위해서는 맥스버스 Console에 먼저 애플리케이션을 등록해야 합니다.

애플리케이션에서 직접 맥스버스 API 호출을 위해 서버사이드 클라이언트 애플리케이션에서 Client Credential 방식의 토큰 발급을 지원합니다. 애플리케이션은 애플리케이션 ID와 애플리케이션 Key를 안전하게 저장하고 이를 패스포트와 교환해 Access Token을 받아야 합니다.

애플리케이션에 권장되는 flow는 OAuth 2.0 및 OpenID Connect 프로토콜을 사용합니다.

  1. 클라이언트 애플리케이션은 클라이언트 자격 증명을 사용해 패스포트 인증 서버에 인증 요청을 합니다.
    • 애플리케이션 ID와 Key는 맥스버스 Console에서 애플리케이션을 등록하면 확인할 수 있습니다.
  2. 요청한 자격 증명이 올바를 경우, 패스포트 서버에서 Access Token을 응답합니다.
  3. 애플리케이션은 Access Token을 사용해 리소스 서버에 인가된 요청을 보냅니다.
  4. 리소스 서버는 요청을 받으면 토큰의 유효성을 검증하고 응답합니다.

토큰

애플리케이션 인증 방식으로 발급된 토큰은 Access Token으로 각 리소스 서버에서 검증하는데 사용됩니다. Access Token은 맥스버스 API 호출에 사용되는 토큰으로 사용자의 권한 정보가 담겨 있습니다. 만료시간은 1시간입니다.

Access Token 페이로드

NameTypeDescription
appString애플리케이션의 ID
subStringApplication 인증 방식의 Access Token은 클라이언트 ID가 sub에 포함
audString클라이언트 ID
bizString애플리케이션의 그룹 ID
azpString클라이언트 ID
auth_timeString인증을 완료한 시각, UNIX Timestamp
issStringAccess Token을 발급한 인증기관의 정보
typStringAccess Token의 Type
expIntegerAccess Token 만료 시간, UNIX Timestamp
iatIntegerAccess Token 발급 시간, UNIX Timestamp
jtiStringJWT 토큰의 unique identifier

토큰 요청

Client Credential Flow로 토큰을 발급 받기 위한 API입니다. 인증 정보는 Body Parameter(application/x-www-form-urlencoded)를 사용 합니다.

기본 정보

POST /passport/token HTTP/1.1
HOST : api.maxst.com
Content-Type : x-www-form-urlencoded
Request
NameTypeDescriptionRequired
grant_typeStringclient_credentials 만 허용O
client_idString콘솔에서 확인할 수 있는 애플리케이션 IDO
client_secretString콘솔에서 확인할 수 있는 애플리케이션 KeyO
Request Example
curl -v -X POST 'https://api.maxst.com/passport/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials' \
-d 'client_id=${애플리케이션_ID}' \
-d 'client_secret=${애플리케이션_KEY}'
Response
NameTypeDescription
access_tokenString발급 받은 액세스 토큰
token_typeString토큰의 타입
expires_inInteger토큰의 유효 시간
Response Example
Response[Success]
{
"access_token": "{ACCESS_TOKEN}",
"token_type": "Bearer",
"expires_in": 3599
}
Response[Failure]
{
"error": "T001",
"description": "invalid grant type"
}
{
"error": "T006",
"description": "invalid client or client secret"
}