mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
changed oauthVersion to version
This commit is contained in:
committed by
Nick Martin
parent
30b6b31448
commit
bba4685269
@@ -17,7 +17,7 @@
|
||||
'&redirect_uri=' + Meteor.accounts.facebook._appUrl + '/_oauth/facebook?close' +
|
||||
'&display=' + display + '&scope=' + scope + '&state=' + state;
|
||||
|
||||
Meteor.accounts.oauth.initiateLogin(state, loginUrl, { oauthVersion: 2 });
|
||||
Meteor.accounts.oauth.initiateLogin(state, loginUrl, { version: 2 });
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Meteor.accounts.facebook._secret = secret;
|
||||
};
|
||||
|
||||
Meteor.accounts.oauth.registerService('facebook', {oauthVersion: 2}, function(query) {
|
||||
Meteor.accounts.oauth.registerService('facebook', {version: 2}, function(query) {
|
||||
if (query.error) {
|
||||
// The user didn't authorize access
|
||||
return null;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
'&redirect_uri=' + Meteor.accounts.google._appUrl + '/_oauth/google?close' +
|
||||
'&state=' + state;
|
||||
|
||||
Meteor.accounts.oauth.initiateLogin(state, loginUrl, { oauthVersion: 2 });
|
||||
Meteor.accounts.oauth.initiateLogin(state, loginUrl, { version: 2 });
|
||||
};
|
||||
|
||||
}) ();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Meteor.accounts.google._secret = secret;
|
||||
};
|
||||
|
||||
Meteor.accounts.oauth.registerService('google', {oauthVersion: 2}, function(query) {
|
||||
Meteor.accounts.oauth.registerService('google', {version: 2}, function(query) {
|
||||
if (query.error) {
|
||||
// The user didn't authorize access
|
||||
return null;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// nothing should happen.
|
||||
var tryLoginAfterPopupClosed = function(state, options) {
|
||||
Meteor.apply('login', [
|
||||
{oauth: {version: options.oauthVersion, state: state}}
|
||||
{oauth: {version: options.version, state: state}}
|
||||
], {wait: true}, function(error, result) {
|
||||
if (error)
|
||||
throw error;
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
// arguments to Meteor.accounts.updateOrCreateUser)
|
||||
// - `null` if the user declined to give permissions
|
||||
Meteor.accounts.oauth.registerService = function (name, options, handleOauthRequest) {
|
||||
var oauthAccounts = Meteor.accounts['oauth' + options.oauthVersion];
|
||||
var oauthAccounts = Meteor.accounts['oauth' + options.version];
|
||||
|
||||
if (oauthAccounts._services[name])
|
||||
throw new Error("Already registered the " + name + " OAuth" + options.oauthVersion + " service");
|
||||
throw new Error("Already registered the " + name + " OAuth" + options.version + " service");
|
||||
|
||||
oauthAccounts._services[name] = {
|
||||
handleOauthRequest: handleOauthRequest
|
||||
@@ -24,11 +24,11 @@
|
||||
};
|
||||
|
||||
Meteor.accounts.oauth._setup = function(setupOptions) {
|
||||
var oauthAccounts = Meteor.accounts['oauth' + setupOptions.oauthVersion];
|
||||
var oauthAccounts = Meteor.accounts['oauth' + setupOptions.version];
|
||||
|
||||
// Listen to calls to `login` with an oauth option set
|
||||
Meteor.accounts.registerLoginHandler(function (options) {
|
||||
if (!options.oauth || options.oauth.version !== setupOptions.oauthVersion)
|
||||
if (!options.oauth || options.oauth.version !== setupOptions.version)
|
||||
return undefined; // don't handle
|
||||
|
||||
var result = oauthAccounts._loginResultForState[options.oauth.state];
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Meteor.accounts.oauth1._services = {};
|
||||
|
||||
Meteor.accounts.oauth._setup({oauthVersion: 1});
|
||||
Meteor.accounts.oauth._setup({version: 1});
|
||||
|
||||
// connect middleware
|
||||
Meteor.accounts.oauth1._handleRequest = function (req, res, next) {
|
||||
|
||||
@@ -7,7 +7,7 @@ Tinytest.add("oauth2 - loginResultForState is stored", function (test) {
|
||||
Meteor.accounts.oauth1._services = {};
|
||||
|
||||
// register a fake login service - foobook
|
||||
Meteor.accounts.oauth.registerService("foobook", {oauthVersion: 1}, function (query) {
|
||||
Meteor.accounts.oauth.registerService("foobook", {version: 1}, function (query) {
|
||||
return {
|
||||
options: {
|
||||
email: email,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Meteor.accounts.oauth2._services = {};
|
||||
|
||||
Meteor.accounts.oauth._setup({oauthVersion: 2});
|
||||
Meteor.accounts.oauth._setup({version: 2});
|
||||
|
||||
// connect middleware
|
||||
Meteor.accounts.oauth2._handleRequest = function (req, res, next) {
|
||||
|
||||
@@ -10,7 +10,7 @@ Tinytest.add("oauth2 - loginResultForState is stored", function (test) {
|
||||
Meteor.accounts.oauth2._services = {};
|
||||
|
||||
// register a fake login service - foobook
|
||||
Meteor.accounts.oauth.registerService("foobook", {oauthVersion: 2}, function (query) {
|
||||
Meteor.accounts.oauth.registerService("foobook", {version: 2}, function (query) {
|
||||
return {
|
||||
options: {
|
||||
email: email,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
var callbackUrl = Meteor.accounts.twitter._appUrl + '/_oauth/twitter?close&state=' + state;
|
||||
var url = '/_oauth/twitter/request_token?callbackUrl=' + encodeURIComponent(callbackUrl)
|
||||
|
||||
Meteor.accounts.oauth.initiateLogin(state, url, { oauthVersion: 1 });
|
||||
Meteor.accounts.oauth.initiateLogin(state, url, { version: 1 });
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Meteor.accounts.twitter._secret = secret;
|
||||
};
|
||||
|
||||
Meteor.accounts.oauth.registerService('twitter', {oauthVersion: 1}, function(oauth) {
|
||||
Meteor.accounts.oauth.registerService('twitter', {version: 1}, function(oauth) {
|
||||
|
||||
var identity = oauth.get('https://api.twitter.com/1/account/verify_credentials.json');
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
'&redirect_uri=' + Meteor.accounts.weibo._appUrl + '/_oauth/weibo?close' +
|
||||
'&state=' + state;
|
||||
|
||||
Meteor.accounts.oauth.initiateLogin(state, loginUrl, { oauthVersion: 2 });
|
||||
Meteor.accounts.oauth.initiateLogin(state, loginUrl, { version: 2 });
|
||||
};
|
||||
|
||||
}) ();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Meteor.accounts.weibo._secret = secret;
|
||||
};
|
||||
|
||||
Meteor.accounts.oauth.registerService('weibo', {oauthVersion: 2}, function(query) {
|
||||
Meteor.accounts.oauth.registerService('weibo', {version: 2}, function(query) {
|
||||
if (query.error) {
|
||||
// The user didn't authorize access
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user