PHP不是我的优势,但我想用PHP sdk初始化一个Parse App以获得额外的安全性,然后将这些凭据安全地传递给javascript,而不会泄露API密钥和令牌。这可能吗?
我尝试过这样的方法,但无济于事:
// Initialize with PHP
<?php
require 'autoload.php';
use Parse\ParseClient;
ParseClient::initialize(MY CREDENTIALS HERE);
// https://github.com/parseplatform/parse-php-sdk
$newUser = new ParseObject("TestObject");
?>
然后包含javascript SDK并使用Javascript ...
var user = "<?php echo $newUser ?>";
user.save({
name: "John",
email: "email@email.com",
zipcode: "12345"
}).then(function(object) {
alert("yay! it worked");
console.log(object);
});