From c72cea80071bcdb9fd564768f5381391658ea4c1 Mon Sep 17 00:00:00 2001 From: Gregor Date: Tue, 24 Jan 2017 14:27:36 -0800 Subject: [PATCH] feat: `account.signIn({token})` --- lib/sign-in.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/sign-in.js b/lib/sign-in.js index 6da8408..682359b 100644 --- a/lib/sign-in.js +++ b/lib/sign-in.js @@ -10,8 +10,12 @@ internals.request = require('../utils/request') internals.serialise = require('../utils/serialise') function signIn (state, options) { - if (!options || !options.username || !options.password) { - return Promise.reject(new Error('options.username and options.password is required')) + if (!options) { + options = {} + } + var usernameOrPasswordUnset = !options.username || !options.password + if (usernameOrPasswordUnset && !options.token) { + return Promise.reject(new Error('options.username/options.password or options.token required')) } return state.ready