224 lines
7.1 KiB
HTML
224 lines
7.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>GamePot JS SDK Sandbox</title>
|
|
<meta charset="utf-8" />
|
|
<!-- <meta
|
|
name="viewport"
|
|
content="width=device-width, initial-scale=1, shrink-to-fit=no"
|
|
/> -->
|
|
|
|
<!-- <link
|
|
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
|
|
rel="stylesheet"
|
|
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
|
|
crossorigin="anonymous"
|
|
/> -->
|
|
<!-- <script src="https://gamepot.gcdn.ntruss.com/gamepot-sdk-javascript-lastest.min.js"></script> -->
|
|
<script src="https://cdn.gamepot.io/dev/gamepot-sdk-javascript-1.0.19-b1.min.js"></script>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
|
|
|
</head>
|
|
|
|
<body class="container-fluid" style="margin-bottom: 200px;">
|
|
<script type="text/javascript">
|
|
|
|
function onLoginsuccess(user) {
|
|
// -- 로그인 성공
|
|
// id: 회원 아이디
|
|
// token: 로그인 토큰(JWT)
|
|
// nickname: 닉네임
|
|
// provider: 소셜 로그인 종류
|
|
// providerId: 소셜 로그인 ID
|
|
// verify: 인증여부
|
|
// agree: 약관 동의 여부
|
|
//===========================
|
|
|
|
const formauth = document.createElement('form');
|
|
let objs1 = document.createElement('input');
|
|
objs1.setAttribute('type', 'hidden');
|
|
objs1.setAttribute('name', 'state');
|
|
objs1.setAttribute('value', '{{ .State }}');
|
|
formauth.appendChild(objs1);
|
|
|
|
let objs2 = document.createElement('input');
|
|
objs2.setAttribute('type', 'hidden');
|
|
objs2.setAttribute('name', 'id');
|
|
objs2.setAttribute('value', `${user.id}`);
|
|
formauth.appendChild(objs2);
|
|
|
|
let objs3 = document.createElement('input');
|
|
objs3.setAttribute('type', 'hidden');
|
|
objs3.setAttribute('name', 'code');
|
|
objs3.setAttribute('value', `${user.token}`);
|
|
formauth.appendChild(objs3);
|
|
|
|
let objs4 = document.createElement('input');
|
|
objs4.setAttribute('type', 'hidden');
|
|
objs4.setAttribute('name', 'nickname');
|
|
objs4.setAttribute('value', `${user.nickname}`);
|
|
formauth.appendChild(objs4);
|
|
|
|
let objs5 = document.createElement('input');
|
|
objs5.setAttribute('type', 'hidden');
|
|
objs5.setAttribute('name', 'provider');
|
|
objs5.setAttribute('value', `${user.provider}`);
|
|
formauth.appendChild(objs5);
|
|
|
|
let objs6 = document.createElement('input');
|
|
objs6.setAttribute('type', 'hidden');
|
|
objs6.setAttribute('name', 'providerId');
|
|
objs6.setAttribute('value', `${user.providerId}`);
|
|
formauth.appendChild(objs6);
|
|
|
|
let objs7 = document.createElement('input');
|
|
objs7.setAttribute('type', 'hidden');
|
|
objs7.setAttribute('name', 'verify');
|
|
objs7.setAttribute('value', `${user.verify}`);
|
|
formauth.appendChild(objs7);
|
|
|
|
let objs8 = document.createElement('input');
|
|
objs8.setAttribute('type', 'hidden');
|
|
objs8.setAttribute('name', 'agree');
|
|
objs8.setAttribute('value', `${user.agree}`);
|
|
formauth.appendChild(objs8);
|
|
|
|
formauth.setAttribute('method', 'post');
|
|
formauth.setAttribute('action', '/authorize/gamepot');
|
|
document.body.appendChild(formauth);
|
|
formauth.submit();
|
|
}
|
|
|
|
function onLoginFail(error) {
|
|
const formauth = document.createElement('form');
|
|
formauth.setAttribute('method', 'post');
|
|
formauth.setAttribute('action', 'actionsquare://error?errormsg='+ encodeURIComponent(`${error.code}-${error.message}`));
|
|
document.body.appendChild(formauth);
|
|
formauth.submit();
|
|
}
|
|
|
|
function onSignInGoogle(error, user) {
|
|
if (error) {
|
|
// 로그인 실패
|
|
onLoginFail(error);
|
|
} else {
|
|
onLoginsuccess(user);
|
|
}
|
|
}
|
|
|
|
function SignIn(channeltype) {
|
|
GP.login(channeltype, function (user, error) {
|
|
if (error) {
|
|
// 로그아웃 실패
|
|
onLoginFail(error);
|
|
} else {
|
|
// 로그인 성공
|
|
onLoginsuccess(user)
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function Logout() {
|
|
// GP.logout(function (error) {});
|
|
GP.logout(function (result, error) {
|
|
if (error) {
|
|
// 로그아웃 실패
|
|
alert(error); // 오류 메세지
|
|
} else {
|
|
// 로그아웃 아웃 완료
|
|
alert("로그아웃 아웃 완료");
|
|
}
|
|
});
|
|
}
|
|
|
|
function deleteMember() {
|
|
if (!userId) {
|
|
alert("로그인을 먼저 해 주세요.");
|
|
return;
|
|
}
|
|
GP.deleteMember(userId, function (result, error) {
|
|
if (error) {
|
|
// 회원탈퇴 실패
|
|
alert(error); // 오류 메세지
|
|
} else {
|
|
// 회원탈퇴 아웃 완료
|
|
alert("회원탈퇴 성공!");
|
|
}
|
|
});
|
|
}
|
|
|
|
window.onload = function () {
|
|
// 프로젝트 ID는 게임팟 대시보드에서 확인할 수 있습니다.
|
|
var project_id = "dbfe1334-6dde-43e0-b8a9-cc0733d4c60e";
|
|
|
|
var gamepotConfig = {
|
|
|
|
api_url: "https://gpapps.gamepot.ntruss.com",
|
|
google_signin_client_id:
|
|
"46698421246-aeg0c2pmsgifr3fi06jgnqag5u8ph3kn.apps.googleusercontent.com",
|
|
google: {
|
|
callback: onSignInGoogle, // callback 버튼
|
|
renderButton: "googleRenderButton", // 버튼 DIV 이름
|
|
option: {
|
|
// google button option
|
|
size: "large",
|
|
theme: "outline",
|
|
width: "375",
|
|
text: "signup_with",
|
|
shape: "rectangular",
|
|
logo_alignment: "left",
|
|
locale: "ko_kr"
|
|
}
|
|
},
|
|
facebook_app_id: "2930531180541185",
|
|
apple_client_id: "auth.service.action2quare.com",
|
|
apple_redirect_uri: "{{.RedirectBaseUrl}}/authorize/apple",
|
|
api_key: "b94615af2a956facd2add44ea50529154b35f520de85673d",
|
|
};
|
|
|
|
GP.initialize(project_id, gamepotConfig);
|
|
};
|
|
|
|
</script>
|
|
<div align="center">
|
|
|
|
|
|
<br />
|
|
<div id="googleRenderButton"></div>
|
|
<br />
|
|
|
|
|
|
<div>
|
|
<table class="table" border="0" width="400" bgcolor="white" style="table-layout: fixed" onclick="SignIn(GP.ChannelType.APPLE)">
|
|
<tr>
|
|
<td align="center">
|
|
<div
|
|
id="appleid-signin"
|
|
data-mode="center-align"
|
|
data-type="sign-in"
|
|
data-color="white"
|
|
data-border="true"
|
|
data-border-radius="15"
|
|
data-width="375"
|
|
data-height="40"
|
|
data-logo-size="medium"
|
|
data-logo-position="47"
|
|
data-label-position="135"
|
|
style="pointer-events: none"
|
|
></div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
</div>
|
|
|
|
|
|
<br />
|
|
|
|
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|