mirror of
https://github.com/zhigang1992/firebase-tools.git
synced 2026-05-25 10:22:40 +08:00
* New auth fully operational and used throughout * Renames "blank" to "deploy:empty" * Adds "data:get" command (whee!) * Use random UUID for Google Analytics * Remove "bootstrap" (to be merged with "init")
26 lines
816 B
JavaScript
26 lines
816 B
JavaScript
'use strict';
|
|
|
|
// var configstore = require('./configstore');
|
|
var FirebaseError = require('./error');
|
|
var chalk = require('chalk');
|
|
var RSVP = require('rsvp');
|
|
var api = require('./api');
|
|
var requireAuth = require('./requireAuth');
|
|
var getFirebaseName = require('./getFirebaseName');
|
|
|
|
module.exports = function(options) {
|
|
var firebase = getFirebaseName(options);
|
|
|
|
return requireAuth(options).then(function() {
|
|
return api.request('GET', '/firebase/' + firebase + '/token', {auth: true});
|
|
}).then(function(res) {
|
|
options.dataToken = res.body.personalToken;
|
|
options.adminToken = res.body.firebaseToken;
|
|
return;
|
|
}, function() {
|
|
return RSVP.reject(new FirebaseError('Unable to authorize access to ' + chalk.bold(firebase) + '. Check spelling and try again.', {
|
|
exit: 1
|
|
}));
|
|
});
|
|
};
|