【发布时间】:2014-05-10 07:17:23
【问题描述】:
我一直在使用 google+ 登录 API,
- 当用户链接他的新帐户时(通过尚未登录的方式 Google+ 社交网络)在我创建的 api 应用中
- 系统会引导用户创建 Google+ 个人资料屏幕。
- 按下提交按钮时,它被定向到一个 URL,然后它不再加载,使屏幕空白不知道是否 用户的帐户是在 google+ 中创建的。
我已经追踪到包含这个的错误:
Load denied by X-Frame-Options: https://accounts.google.com/o/oauth2/auth?XXXXXXXX does not permit cross-origin framing.
因此它不会继续访问该 url,因为 X-Frame-Options 正在阻止它。
我研究了X-Frame-Options,说应该在header中设置。
我将如何在这个标题中设置它:
<meta name="google-signin-clientid" content="{{=response.CLIENT_ID}}" />
<meta name="google-signin-scope" content="https://www.googleapis.com/auth/plus.login" />
<meta name="google-signin-requestvisibleactions" content="http://schemas.google.com/AddActivity" />
<meta name="google-signin-cookiepolicy" content="single_host_origin" />
我正在以这种方式渲染我的按钮:
(function() {
var po = document.createElement('script');
po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/client:plusone.js?onload=render';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
})();
function render() {
// Additional params including the callback, the rest of the params will
// come from the page-level configuration.
var additionalParams = {
'callback': signinCallback,
'immediate': false,
};
// Attach a click listener to a button to trigger the flow.
var signinButton = document.getElementById('signinButton');
signinButton.addEventListener('click', function() {
gapi.auth.signIn(additionalParams); // Will use page level configuration
});
}
或者还有什么其他的设置方法?或者如何解决这个错误?我的后端部分是 python。
【问题讨论】:
标签: javascript jquery python html google-api