From 89ccb6480df3d33023f9422946f23a203ff8d2ce Mon Sep 17 00:00:00 2001 From: Pagan Gazzard Date: Wed, 26 Apr 2017 13:52:43 -0700 Subject: [PATCH] Fix the case of being registered with a version of the cli/sdk that does not support device api keys. Change-Type: patch --- src/bootstrap.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bootstrap.coffee b/src/bootstrap.coffee index 701c1912..54e80263 100644 --- a/src/bootstrap.coffee +++ b/src/bootstrap.coffee @@ -106,7 +106,9 @@ bootstrap = -> .then -> knex('config').insert([ { key: 'uuid', value: userConfig.uuid } - { key: 'apiKey', value: userConfig.deviceApiKey } + # We use the provisioning/user `apiKey` if it still exists because if it does it means we were already registered + # using that key and have to rely on the exchange key mechanism to swap the keys as appropriate later + { key: 'apiKey', value: userConfig.apiKey ? userConfig.deviceApiKey } { key: 'username', value: userConfig.username } { key: 'userId', value: userConfig.userId } { key: 'version', value: utils.supervisorVersion }