Skip to content
Snippets Groups Projects
Commit 4f56d3d7 authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

Merge branch 'fix/client-connect-to-tier-direct' into 'dev'

fix: missing pce when coming from client connect

See merge request !33
parents fa0cdd00 02b2ebdb
No related branches found
No related tags found
3 merge requests!43Merge dev into master,!342.0.3 Release,!33fix: missing pce when coming from client connect
Pipeline #101740 passed
......@@ -80,7 +80,12 @@ async function start(fields, cozyParameters) {
)
}
const { pce, email, firstname, lastname, postalCode } = fields
let { pce, email, firstname, lastname, postalCode } = fields
if (!pce && fields?.oauth_callback_results?.pce) {
pce = fields.oauth_callback_results.pce
log('info', `OAuth callback result found, using pce ${pce}`)
}
const transaction = Sentry.startTransaction({
op: 'konnector',
......@@ -102,6 +107,11 @@ async function start(fields, cozyParameters) {
const boUrlGRDF = new URL('/api/grdf', boBaseUrl).href
try {
if (!pce) {
log('error', 'No PCE found')
throw errors.VENDOR_DOWN
}
log('info', `using PCE: ${pce}`)
const { access_token } = await getAuthToken(grdfId, grdfSecret)
const consents = await getConsents(access_token, pce)
const noValidConsent = await handleConsents(consents, boUrlGRDF, boToken)
......
......@@ -44,6 +44,10 @@ export type fields = {
lastname: string
firstname: string
postalCode: string
/** previous PCE from oauth stored in account */
oauth_callback_results?: {
pce?: string
}
}
/** Cozy parameters definition */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment