From 22ff7b3bdbcd2352625c218c325cd71114b5f5ef Mon Sep 17 00:00:00 2001
From: Yoan VALLET <ext.sopra.yvallet@grandlyon.com>
Date: Wed, 30 Sep 2020 14:30:26 +0200
Subject: [PATCH] use handleOAuthResponse

---
 src/cozy-harvest-lib.d.ts     | 1 +
 src/targets/browser/index.tsx | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/cozy-harvest-lib.d.ts b/src/cozy-harvest-lib.d.ts
index 0f45be52b..6322ea790 100644
--- a/src/cozy-harvest-lib.d.ts
+++ b/src/cozy-harvest-lib.d.ts
@@ -4,3 +4,4 @@ declare module 'cozy-harvest-lib/dist/connections/triggers'
 declare module 'cozy-harvest-lib/dist/helpers/triggers'
 declare module 'cozy-harvest-lib/dist/models/ConnectionFlow'
 declare module 'cozy-harvest-lib/dist/components/OAuthWindow'
+declare module 'cozy-harvest-lib/dist/helpers/oauth'
diff --git a/src/targets/browser/index.tsx b/src/targets/browser/index.tsx
index f9fdb9294..be2dfb3c7 100644
--- a/src/targets/browser/index.tsx
+++ b/src/targets/browser/index.tsx
@@ -8,13 +8,14 @@ import ReactDOM, { render } from 'react-dom'
 import { Document } from 'cozy-doctypes'
 import { I18n } from 'cozy-ui/transpiled/react'
 import { initTranslation } from 'cozy-ui/transpiled/react/I18n'
+import { handleOAuthResponse } from 'cozy-harvest-lib/dist/helpers/oauth'
 import schema from 'doctypes'
 
 const manifest = require('../../../manifest.webapp')
 
 const renderApp = (polyglot: any, lang: string, client: Client) => {
+  if (handleOAuthResponse()) return
   const App = require('components/App').default
-
   render(
     <CozyProvider client={client}>
       <I18n lang={lang} polyglot={polyglot}>
-- 
GitLab