From 65aba346c882f767529650db4eb80c4547e325ed Mon Sep 17 00:00:00 2001 From: git-directory-deploy <> Date: Mon, 4 Jan 2021 11:36:09 +0100 Subject: [PATCH] publish: Merge branch 'dev' into 'master' generated from commit 6c418b547c135d652f5aa7b805ee25c8e11f3818 --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 49509c1..e49d867 100644 --- a/index.js +++ b/index.js @@ -146,7 +146,10 @@ async function start(fields, cozyParameters, doRetry = true) { ',' ) usage_point_id = usage_points_id[0] - } else { + } else if (fields.usage_point_id) { + // In case of refresh token, we retrieve the usage point id from the fields + usage_point_id = fields.usage_point_id + }else { log('error', 'no usage_point_id found') throw errors.USER_ACTION_NEEDED_OAUTH_OUTDATED } @@ -185,6 +188,7 @@ async function start(fields, cozyParameters, doRetry = true) { log('info', 'refresh response') log('info', JSON.stringify(body)) fields.access_token = body.attributes.oauth.access_token + fields.usage_point_id = usage_point_id return start(fields, cozyParameters, false) } log('error', `Error during authentication: ${err.message}`) -- GitLab