Commit 42707bb6 authored by git-directory-deploy's avatar git-directory-deploy
Browse files

fix pce issue

parent 333d893c
......@@ -64,18 +64,17 @@ async function start(fields, cozyParameters, doRetry = true) {
'debug',
'KONNECTOR ACCOUNT : ' + this._account.oauth_callback_results.id_token
)
let id_pce = ''
if (
this._account &&
this._account.oauth_callback_results &&
this._account.oauth_callback_results.id_token
) {
log('debug', 'time to decode jwt')
id_pce = await getPCEid(this._account.oauth_callback_results.id_token) //19108248691849 PCEid FOR TESTING PURPOSE
const id_pce = await getPCEid(this._account.oauth_callback_results.id_token) //19108248691849 PCEid FOR TESTING PURPOSE
// Store pce and restart
// const data = [{ id_pce: id_pce }];
log('debug', 'Fetching grdf adict daily data')
log('debug', 'THE ID_PCE SENDING TO GETDATA : ', id_pce)
log('debug', 'THE ID_PCE SENDING TO GETDATA : ' + id_pce)
const grdfData = await getData(access_token, id_pce)
......@@ -139,7 +138,7 @@ async function start(fields, cozyParameters, doRetry = true) {
async function getPCEid(tokenToDecrypt) {
// verify a token symmetric - synchronous
log('debug', 'GETPCEID : ', tokenToDecrypt)
log('debug', 'GETPCEID : ' + tokenToDecrypt)
var decoded = jwt.decode(tokenToDecrypt)
const decodedConsentements = JSON.parse(decoded.consentements)
return decodedConsentements[0].pce
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment