본문 바로가기메인 메뉴 바로가기사이드 메뉴 바로가기

kakao developers

Related sites
  • Docs
  • JavaScript
  • Upgrade v1 to v2

사이드 메뉴

Kakao Map

Search

This document guides information to upgrade Kakao SDK for JavaScript("JavaScript SDK") from v1(lower version of 2.0.0) to v2(version 2.0.0 or higher).

The minimum supported version of Internet Explorer (IE) is changed to IE 11 in JavaScript SDK v2. To support IE 9 or IE 10, use Legacy JavaScript SDK.

To load the JavaScript SDK v2, the version must be specified inside the <script> element.

integrity is an attribute for Subresource Integrity (SRI). To strengthen security, use integrity. To copy the script tag or the integrity value of the desired SDK version, see Download.

<!-- Before -->
<script src="https://t1.kakaocdn.net/kakao_js_sdk/v1/kakao.min.js"></script>
<!-- After -->
<script src="https://t1.kakaocdn.net/kakao_js_sdk/${VERSION}/kakao.min.js" integrity="${INTEGRITY_VALUE}" crossorigin="anonymous"></script>

The functions in the JavaScript SDK v2 return the Promise objects instead of callback parameters such as success, fail, and always.

Replace the callback parameters with the Promise.then() and Promise.catch() functions by referring to the following sample snippet and each development guide.

// Before
Kakao.API.request({
url: "/v2/user/me",
success: function (response) {
console.log(response)
},
fail: function (error) {
console.log(error)
},
})
// After
Kakao.API.request({
url: "/v2/user/me",
})
.then(function (response) {
console.log(response)
})
.catch(function (error) {
console.log(error)
})

To provide a better service with strengthened security, JavaScript SDK v2 does not provide the associated functions used to obtain an access token on the client side by presenting popup window in JavaScript SDK v1.

To integrate Kakao Login with the JavaScript SDK v2, use the Kakao.Auth.authorize() function instead.

FeatureJavaScript SDK v1JavaScript SDK v2
Kakao LoginKakao.Auth.login()
Kakao.Auth.createLoginButton()
Kakao.Auth.loginForm()
Kakao.Auth.autoLogin()
Kakao.Auth.authorize()

As some service names are changed, the associated modules and API request URLs are changed as follows.

FeatureJavaScript SDK v1JavaScript SDK v2
Kakao Talk ShareKakao.LinkKakao.Share
Kakao Talk ChannelKakao.PlusFriendKakao.Channel
Check Kakao Talk Channel relationship/v1/api/talk/plusfriends/v1/api/talk/channels

Was this helpful?