액세스 토큰 발급
액세스 토큰(Access Token) 발급 절차에 대해 설명합니다.
사전 조건
1. 인증 정보 생성 결과로 발급받은 Basic Authorization Header가 있어야 합니다.
액세스 토큰 발급 절차
1. 터미널을 실행합니다.
2. Basic Authorization Header를 사용하여 ChainZ API 인증 서버에 액세스 토큰 발급 요청을 합니다.
curl 'https://iam.chainz.biz/auth/realms/chainz/protocol/openid-connect/token' \
-H 'Authorization: {Basic_Authorization_Header}' \
--data-raw 'grant_type=client_credentials'
{
"access_token": "{엑세스 토큰}",
"expires_in": 300,
"refresh_expires_in": 0,
"token_type": "Bearer",
"not-before-policy": 0,
"scope": "opera-scope profile email"
}
발급된 액세스 토큰의 기본 유효기간은 600초입니다. 따라서 Application 구현 서버에서는 600초 이내에 갱신할 수 있도록 추가 작업이 필요합니다.
문제 해결
1. unauthorized_client
잘못된 Basic Authorization Header 입력 시, 다음과 같이 'unauthorized_client' error의 결과가 나타납니다.
curl 'https://{ChainZ API 인증 서버 URL}/auth/realms/chainz/protocol/openid-connect/token' \
-H 'Authorization: {잘못된 Basic Authorization Header}' \
--data-raw 'grant_type=client_credentials'
{"error":"unauthorized_client","error_description":"Invalid client secret"}
{
"error": "unauthorized_client",
"error_description": "Invalid client secret"
}
2. URL using bad/illegal format or missing URL
터미널에서 curl 입력 시, 역슬래시(\)뒤에 공백이 있으면, 잘못된 형태이거나 없는 URL이라는 메시지(URL using bad/illegal format or missing URL)를 Response로 받습니다.
$ curl 'https://iam.chainz.biz/auth/realms/chainz/protocol/openid-connect/token' \
{"error":"RESTEASY003650: No resource method found for GET, return 405 with Allow header"}
curl: (3) URL using bad/illegal format or missing URL
Last updated
Was this helpful?