diff --git a/docs/ecolyo/konnectors/enedis.md b/docs/ecolyo/konnectors/enedis.md index 4c238e1d1727dce030972e03a1048097be3216da..34669c2102edad427059faadd7e44a7ab416928e 100644 --- a/docs/ecolyo/konnectors/enedis.md +++ b/docs/ecolyo/konnectors/enedis.md @@ -81,3 +81,21 @@ For more information about Datahub-Enedis API, checkout the [Datahub documentati | buildDataFromKey | Format an entry for DB storage using key and value. For year doctype: key = "YYYY". For month doctype: key = "YYYY-MM" | | isHistoryLoaded | Function checking if the history is loaded | | resetInProgressAggregatedData | Function handling special case.The temporary aggregated data need to be remove in order for the most recent one te be saved. Ex for com.grandlyon.enedis.year : `{ load: 76.712, year: 2020, ... }` need to be replace by `{ load: 82.212, year: 2020, ... }` after enedis data reprocess | + +## Troubleshooting when asking for refresh token + +When a token expires, the konnector will encounter an error when fetching user data, leading to a refresh token request. + +Since refresh token requests restart the Konnector, it was decided to add the ```usage_point_id``` into the start fields when asking for a refresh token (see line 97). + +!!! info "restart to refresh token" + Line 85: ```await cozyClient.fetchJSON( + 'POST', + `/accounts/enedisgrandlyon/${accountId}/refresh` + )``` + + Line 97: ```fields.usage_point_id = usage_point_id``` + + Line 98: ```return start(fields, cozyParameters, false)``` + +In fact the usage_point_id still remains in the account collection, but on restart, the konnector loses ```this._account``` context leading to an error when searching for usage_point_id in account. \ No newline at end of file