mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Add OAuth login to package stats reporting
This commit is contained in:
@@ -473,8 +473,12 @@ var oauthFlow = function (conn, options) {
|
||||
credentialToken
|
||||
);
|
||||
|
||||
// XXX We're using a test-only flag here to just get the raw
|
||||
// credential secret (instead of a bunch of code that communicates the
|
||||
// credential secret somewhere else); this should be temporary until
|
||||
// we give this a nicer name and make it not just test only.
|
||||
var redirectResult = httpHelpers.request({
|
||||
url: authorizeResult.location,
|
||||
url: authorizeResult.location + '&only_credential_secret_for_test=1',
|
||||
method: 'GET',
|
||||
strictSSL: true
|
||||
});
|
||||
@@ -489,7 +493,10 @@ var oauthFlow = function (conn, options) {
|
||||
|
||||
// XXX tokenId???
|
||||
var loginResult = conn.apply('login', [{
|
||||
oauth: { credentialToken: credentialToken }
|
||||
oauth: {
|
||||
credentialToken: credentialToken,
|
||||
credentialSecret: response.body
|
||||
}
|
||||
}], { wait: true });
|
||||
|
||||
if (loginResult.token && loginResult.id) {
|
||||
@@ -1028,7 +1035,7 @@ exports.loggedInUsername = function () {
|
||||
return loggedIn(data) ? currentUsername(data) : false;
|
||||
};
|
||||
|
||||
// Given a DDP connection, log in with OAuth using Meteor developer
|
||||
// Given a ServiceConnection, log in with OAuth using Meteor developer
|
||||
// accounts. Assumes the user is already logged in to the developer
|
||||
// accounts server.
|
||||
exports.loginWithTokenOrOAuth = function (conn, url, domain, sessionType) {
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
var Fiber = require("fibers");
|
||||
var _ = require("underscore");
|
||||
|
||||
var config = require("./config.js");
|
||||
var uniload = require("./uniload.js");
|
||||
var Fiber = require("fibers");
|
||||
var project = require("./project.js");
|
||||
var _ = require("underscore");
|
||||
var auth = require("./auth.js");
|
||||
var ServiceConnection = require("./service-connection.js");
|
||||
|
||||
// Return a list of packages used by this app, both directly and
|
||||
// indirectly. Formatted as a list of objects with 'name', 'version'
|
||||
@@ -28,11 +31,22 @@ var recordPackages = function (appDir) {
|
||||
// to the package stats server. If we can't connect, for example, we
|
||||
// don't care; we'll just miss out on recording these packages.
|
||||
Fiber(function () {
|
||||
var DDP = uniload.load({
|
||||
var Package = uniload.load({
|
||||
packages: ["livedata"]
|
||||
}).livedata.DDP;
|
||||
var conn = DDP.connect(config.getPackageStatsServerUrl());
|
||||
});
|
||||
var conn = new ServiceConnection(
|
||||
Package,
|
||||
config.getPackageStatsServerUrl()
|
||||
);
|
||||
|
||||
if (auth.isLoggedIn()) {
|
||||
auth.loginWithTokenOrOAuth(
|
||||
conn,
|
||||
config.getPackageStatsServerUrl(),
|
||||
config.getPackageStatsServerDomain(),
|
||||
"package-stats-server"
|
||||
);
|
||||
}
|
||||
// XXX do the right thing in the following cases:
|
||||
// not logged in to meteor account
|
||||
// logged in to meteor accounts, but not logged into package stats server
|
||||
|
||||
Reference in New Issue
Block a user