loginPage.html
2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>login page title</title>
<script src="https://developers.kakao.com/sdk/js/kakao.js"></script>
</head>
<body>
<a id="kakao-login-btn"></a>
<a href="http://developers.kakao.com/logout"></a>
<script>
Kakao.init('0678e32dab56db1c52ac63ab4ccb7663');
console.log(Kakao.isInitialized());
Kakao.Auth.createLoginButton({
container: '#kakao-login-btn',
success: function(authObj){
console.log(JSON.stringify(authObj));
alert(JSON.stringify(authObj));//authObj -> 토큰임.
redirectUrl
},
fail: function(err){
alert(JSON.stringify(err));
}
})
console.log('hi');
Kakao.Link.createDefaultButton({
container: ".kakao-link",
objectType: "feed",
content:{
title: "안녕하세요",
description: "반갑습니다.",
link:{
webUrl: "https://www.naver.com/",
mobileWebUrl: "https://www.naver.com/"
},
},
})
function kakaoLogout(){
Kakao.Auth.logout(function(response){
alert(response+'logout');
Kakao.API.request({
url: '/v1/user/unlink',
success: function(response) {
console.log(response);
},
fail: function(error) {
console.log(error);
console.log("error");
},
})
})
}
</script>
<script>
console.log('hi');
Kakao.Link.createDefaultButton({
container: ".kakao-link",
objectType: "feed",
content:{
title: "안녕하세요",
description: "반갑습니다.",
link:{
webUrl: "https://www.naver.com/",
mobileWebUrl: "https://www.naver.com/"
},
},
})
</script>
<a onclick="kakaoLogout();">카카오 로그아웃</a>
</body>
</html>