access token이 만료될 때 새로운 access token과 refresh token을 얻을 수 있습니다.
access token의 기본 수명은 약 1시간, refresh token은 약 30일이며 refresh token api를 사용할 때마다 갱신됩니다.
refresh token은 Authorization code, Username/Password 인증에서만 발급됩니다.
POST https://auth.smtown.com/oauth/token
Authorization: Basic MGYxOWYxNG==
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token&scope=profile.info&refresh_token=0f244a6ff13c8fcf20bb6bab5fc6f
| 파라메타 | 필수여부 | 설명 |
|---|---|---|
Authorization |
Header 필수 | Basic token 입니다. Basic token 생성을 참고하세요. |
Content-Type |
Header 필수 | POST의 content type 설정 : application/x-www-form-urlencoded 고정 |
grant_type |
필수 | refresh_token 고정 |
scope |
필수 | 공백으로 구분할 수 있습니다. |
refresh_token |
필수 | 인증 섹션에서 전달받은 refresh_token 입니다. |
HTTP/1.1 200
Content-Type: application/json;charset=UTF-8
{
"access_token": "새로운 access token 14d4bc425de754",
"token_type": "bearer",
"refresh_token": "새로운 refresh token fcf20bb6bab5fc6f",
"expires_in": 43199,
"scope": "profile.info"
}
HTTP/1.1 400
Content-Type: application/json;charset=UTF-8
{
"error": "invalid_grant",
"error_description": "Invalid refresh token: 0f244a6ff13c8fcf20bb6bab5fc6f"
}
HTTP/1.1 401
Content-Type: application/json;charset=UTF-8
{
"error": "invalid_token",
"error_description": "Invalid refresh token (expired): 0f244a6ff13c8fcf20bb6bab5fc6f"
}