流星帐户,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:');
我不明白的方式:
- 如何分辨帐户,Facebook的使用权协议,因为没有
absoluteUrlOptions
参数传递给OAuth._redirectUri
- 如何设置
Meteor.absoluteUrl.defaultOptions.secure
- 任何其他选项...
我唯一的解决办法是安装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:');
我不明白的方式:
- 如何分辨帐户,Facebook的使用权协议,因为没有
absoluteUrlOptions
参数传递给OAuth._redirectUri
- 如何设置
Meteor.absoluteUrl.defaultOptions.secure
- 任何其他选项...
我唯一的解决办法是安装meteor add force-ssl
因此整个应用程序运行强迫HTTPS。
一种解决方法是使整个应用程序在运行HTTPS安装力SSL。
meteor add force-ssl
更新:显然你也可以只设置Meteor.absoluteUrl.defaultOptions.secure = true
在正确的地方早在你的应用程序,例如client/lib/...