最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

流星帐户,Facebook已经没有选择使用HTTPS REDIRECT

IT培训 admin 4浏览 0评论

流星帐户,Facebook已经没有选择使用HTTPS REDIRECT

我使用流星accounts-facebook,并希望为需要通过Facebook的使用SSL使用它,但redirect_uri作为http://通过,即使该应用程序是在https://运行。这产生在loginUrl一个facebook-oauth.js的代码如下:

var loginUrl =
        '.9/dialog/oauth?client_id=' + config.appId +
        '&redirect_uri=' + OAuth._redirectUri('facebook', config) +
        '&display=' + display + '&scope=' + scope +
        '&state=' + OAuth._stateParam(loginStyle, credentialToken, options && options.redirectUrl);

这OAuth再次呼吁:

OAuth._redirectUri = function (serviceName, config, params, absoluteUrlOptions) {
  ...
  Meteor.absoluteUrl('_oauth/' + serviceName, absoluteUrlOptions)
  ...
}

在Meteor.absoluteUrl SSL是有先解除其逐出如果Meteor.absoluteUrl.defaultOptions.secure是真实的:

  // merge options with defaults
  options = Object.assign({}, Meteor.absoluteUrl.defaultOptions, options || {});
  ...
  if (!/^http[s]?:\/\//i.test(url)) // url starts with 'http://' or 'https://'
    url = 'http://' + url; // we will later fix to https if options.secure is set
  ...
  // turn http to https if secure option is set, and we're not talking
  // to localhost.
  if (options.secure &&
      /^http:/.test(url) && // url starts with 'http:'
      !/http:\/\/localhost[:\/]/.test(url) && // doesn't match localhost
      !/http:\/\/127\.0\.0\.1[:\/]/.test(url)) // or 127.0.0.1
    url = url.replace(/^http:/, 'https:');

我不明白的方式:

  1. 如何分辨帐户,Facebook的使用权协议,因为没有absoluteUrlOptions参数传递给OAuth._redirectUri
  2. 如何设置Meteor.absoluteUrl.defaultOptions.secure
  3. 任何其他选项...

我唯一的解决办法是安装meteor add force-ssl因此整个应用程序运行强迫HTTPS。

回答如下:

一种解决方法是使整个应用程序在运行HTTPS安装力SSL。

meteor add force-ssl 

更新:显然你也可以只设置Meteor.absoluteUrl.defaultOptions.secure = true在正确的地方早在你的应用程序,例如client/lib/...

流星帐户,Facebook已经没有选择使用HTTPS REDIRECT

我使用流星accounts-facebook,并希望为需要通过Facebook的使用SSL使用它,但redirect_uri作为http://通过,即使该应用程序是在https://运行。这产生在loginUrl一个facebook-oauth.js的代码如下:

var loginUrl =
        '.9/dialog/oauth?client_id=' + config.appId +
        '&redirect_uri=' + OAuth._redirectUri('facebook', config) +
        '&display=' + display + '&scope=' + scope +
        '&state=' + OAuth._stateParam(loginStyle, credentialToken, options && options.redirectUrl);

这OAuth再次呼吁:

OAuth._redirectUri = function (serviceName, config, params, absoluteUrlOptions) {
  ...
  Meteor.absoluteUrl('_oauth/' + serviceName, absoluteUrlOptions)
  ...
}

在Meteor.absoluteUrl SSL是有先解除其逐出如果Meteor.absoluteUrl.defaultOptions.secure是真实的:

  // merge options with defaults
  options = Object.assign({}, Meteor.absoluteUrl.defaultOptions, options || {});
  ...
  if (!/^http[s]?:\/\//i.test(url)) // url starts with 'http://' or 'https://'
    url = 'http://' + url; // we will later fix to https if options.secure is set
  ...
  // turn http to https if secure option is set, and we're not talking
  // to localhost.
  if (options.secure &&
      /^http:/.test(url) && // url starts with 'http:'
      !/http:\/\/localhost[:\/]/.test(url) && // doesn't match localhost
      !/http:\/\/127\.0\.0\.1[:\/]/.test(url)) // or 127.0.0.1
    url = url.replace(/^http:/, 'https:');

我不明白的方式:

  1. 如何分辨帐户,Facebook的使用权协议,因为没有absoluteUrlOptions参数传递给OAuth._redirectUri
  2. 如何设置Meteor.absoluteUrl.defaultOptions.secure
  3. 任何其他选项...

我唯一的解决办法是安装meteor add force-ssl因此整个应用程序运行强迫HTTPS。

回答如下:

一种解决方法是使整个应用程序在运行HTTPS安装力SSL。

meteor add force-ssl 

更新:显然你也可以只设置Meteor.absoluteUrl.defaultOptions.secure = true在正确的地方早在你的应用程序,例如client/lib/...

发布评论

评论列表 (0)

  1. 暂无评论