0
我嘗試構建一個應用程序,我想首先要求權限,因此下面的代碼只做這些,但是當它重定向時,將我轉移到我託管的域中應用。在用戶接受權限後設置一個自定義重定向 - Facebook應用程序
是否可以設置自定義重定向?
非常感謝!
<html>
<head>
<title>Client Flow Example</title>
</head>
<body>
<script>
var appId = "YOUR_APP_ID";
if(window.location.hash.length == 0)
{
url = "https://www.facebook.com/dialog/oauth?client_id=" +
appId + "&redirect_uri=" + window.location +
"&response_type=token";
window.open(url);
} else {
accessToken = window.location.hash.substring(1);
graphUrl = "https://graph.facebook.com/me?" + accessToken +
"&callback=displayUser"
//use JSON-P to call the graph
var script = document.createElement("script");
script.src = graphUrl;
document.body.appendChild(script);
}
function displayUser(user) {
userName.innerText = user.name;
}
</script>
<p id="userName"></p>
</body>
</html>