You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
35 lines
1.1 KiB
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
|
<?php
|
|
$now = gmdate("YmdHis");
|
|
$data = 'M0000.' . $now;
|
|
$sign = hash_hmac('SHA256', $data, '964C834F7BF2BB70', false);
|
|
|
|
?>
|
|
|
|
<script>
|
|
function get_Auth() {
|
|
var api_key = '964C834F7BF2BB70';
|
|
var validation = "";
|
|
// var corsurl = 'http://cors-anywhere.herokuapp.com/';
|
|
var apiurl = 'http://60.244.87.101:780//twWebAPI/GetAuth';
|
|
headerParam = {
|
|
UserId: 'M0000',
|
|
Pwd: 'M012290493119',
|
|
TimestampUTC: <?= $now ?>,
|
|
Sign: '<?= $sign ?>'
|
|
};
|
|
obj = {
|
|
type: 'get',
|
|
// url: `${corsurl}${apiurl}`,
|
|
url: `${apiurl}`,
|
|
dataType: 'json',
|
|
headers: headerParam,
|
|
success: function(res) {
|
|
validation = res.Data['CHI_Authorization'];
|
|
window.parent.postMessage(validation,'http://localhost:3000');
|
|
// window.parent.postMessage(validation,'https://masada.com.tw');
|
|
}
|
|
};
|
|
jQuery.ajax(obj);
|
|
}
|
|
</script>
|