mirror of
https://github.com/zhigang1992/firebase-tools.git
synced 2026-05-25 18:31:37 +08:00
* -s is now --non-interactive * firebase-cli with options but no command no longer hangs * login doesn't run in non-interactive mode * config is now materialized according to the new world specs * config and firebase name are applied in before filters
27 lines
847 B
JavaScript
27 lines
847 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);
|
|
options.firebase = firebase;
|
|
|
|
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
|
|
}));
|
|
});
|
|
};
|