成功登录Facebook后,我收到错误:
无效的范围:user_checkins。此消息仅向开发人员显示。如果存在,您应用的用户将忽略这些权限。请阅读以下文档以获取有效权限:here
我的代码是,
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<!-- You can use Open Graph tags to customize link previews.
Learn more: https://developers.facebook.com/docs/sharing/webmasters -->
<meta property="og:url" content="http://www.your-domain.com/your-page.html" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Your Website Title" />
<meta property="og:description" content="Your description" />
<meta property="og:image" content="http://www.your-domain.com/path/image.jpg" />
<title>AngularQuickstart</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css"/>
<script href="https://cdnjs.cloudflare.com/ajax/libs/ng2-bootstrap/1.1.16/ng2-bootstrap.umd.min.js" > </script>
<link rel="" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/css/bootstrap-flex.min.css" />
<link rel="" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/css/bootstrap-flex.min.css.map" />
<link rel="" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/css/bootstrap-grid.css.map" />
<!-- <script src="fb-sdk.js"></script> -->
</head>
<body>
<script>
// This is called with the results from from FB.getLoginStatus().
function statusChangeCallback(response) {
if (response.status === 'connected') {
// Logged into your app and Facebook.
testAPI();
} else if (response.status === 'not_authorized') {
// The person is logged into Facebook, but not your app.
document.getElementById('status').innerHTML = 'Please log ' +
'into this app.';
//FB.logout();
} else {
// The person is not logged into Facebook, so we're not sure if
// they are logged into this app or not.
document.getElementById('status').innerHTML = 'Please log ' +
'into Facebook.';
}
}
}
function facebookLogin() {
FB.login(function(response) {
statusChangeCallback(response);
if (response.authResponse) {
console.log('Authenticated!');
// location.reload(); //or do whatever you want
} else {
console.log('User cancelled login or did not fully authorize.');
}
},
{
scope: 'email,user_checkins'
});
}
window.fbAsyncInit = function() {
//alert('test');
FB.init({
appId : 'XXX',
channelURL : '', // Channel File, not required so leave empty
status : true,
oauth : true,
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
});
};
// 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 = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
// Here we run a very simple test of the Graph API after login is
// successful. See statusChangeCallback() for when this call is made.
function testAPI() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log("***** FB login response");
console.log(response);
console.log('Successful login for: ' + response.name);
document.getElementById('status').innerHTML =
'Thanks for logging in, ' + response.name + '!';
});
}
</script>
<input type="button" onclick="facebookLogin();" value="fblogin" />
<div id="status">
</div>
</body>
</html>
昨天它对我有用。成功登录后我可以得到回复。但今天我收到了错误。感谢。