//Naver (하나샵만 SNS 연동을 한다.) var naverLogin = new naver.LoginWithNaverId( { clientId: "ZUOVfhgYZc50ZtGic8ta", callbackUrl: "https://"+location.hostname+"/sns/naver_callback.asp", isPopup: true //,loginButton: {color: "green", type: 3, height: 60} } ); /* (4) 네아로 로그인 정보를 초기화하기 위하여 init을 호출 */ naverLogin.init(); $(document).on("click", "#btnNaverIdLogin" ,function() { var certifiUrl = "/sns/naver.asp"; var winName = ""; var features = "left=10, top=0, width=500, height=700"; window.open(certifiUrl, "", features); }); //kakao Kakao.init('fdd42a09a7b2ef28d75111e3f3a0e264'); //발급받은 키 중 javascript키를 사용해준다. console.log(Kakao.isInitialized()); // sdk초기화여부판단 //카카오로그인 function kakaoLogin() { Kakao.Auth.login({ success: function (response) { Kakao.API.request({ url: '/v2/user/me', success: function (response) { // console.log(response) // console.log(response.id) // console.log(response.kakao_account.email) fncSetSnsCertifiedInfo("KAKAO", response.id, '', response.kakao_account.email); }, fail: function (error) { console.log(error) }, }) }, fail: function (error) { console.log(error) }, }) } //카카오로그아웃 function kakaoLogout() { if (Kakao.Auth.getAccessToken()) { Kakao.API.request({ url: '/v1/user/unlink', success: function (response) { console.log(response) }, fail: function (error) { console.log(error) }, }) Kakao.Auth.setAccessToken(undefined) } } //Facebook var FACEBOOKAPPID = "256120508408706"; window.fbAsyncInit = function() { FB.init({ appId : FACEBOOKAPPID, cookie : true, // enable cookies to allow the server to access the session xfbml : true, // parse social plugins on this page version : 'v2.8' // use graph api version 2.8 }); FB.AppEvents.logPageView(); }; // Load the SDK asynchronously (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "https://connect.facebook.net/ko_KR/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); function checkLoginState() { FB.getLoginStatus(function(response) { statusChangeCallback(response); }); } function statusChangeCallback(response) { console.log('statusChangeCallback'); console.log(response); if (response.status === 'connected') { // Logged into your app and Facebook. fncFacebookLogined(); } else { console.log("not login."); } } function fncFacebookLogined() { console.log('Welcome! Fetching your information.... '); FB.api('/me', {fields: 'email,name'}, function(response) { // console.log(response); //id(일련번호)와 이름만 받아올 수 있음. fncSetSnsCertifiedInfo('FACEBOOK', response.id, response.name, response.email); FB.logout(function(response) { // Person is now logged out }); }); } function fncFacebookLogin() { FB.login(function(response){ // Handle the response object, like in statusChangeCallback() in our demo code. statusChangeCallback(response); }, {scope: 'public_profile,email'}); }