How to connect a konnector from the cozy-client


#1

How to?

I’m actually developing an cozy application in react and I would like to be able to pass the login/password to a konnector and then launch it via this application.

Is there a way to do it using the cozy-client?


#2

Hi,

Yes you could, but this would need your app to request the permissions on io.cozy.accounts, create an account, give your connector permissions to this account, then create a trigger.

We usually want to have very few apps touching that, and restrict it to Home and Store, but nothing forbids it technically.

Today most of this work is done by cozy-harvest-lib. Best is to show by example: The code using cozy-client is on https://github.com/cozy/cozy-libs/tree/master/packages/cozy-harvest-lib/src/connections


#3

Hi yvallet,

I am curious about the usecase, is there a reason why you would not want to configure the connector through the home / store ?

We usually want to have very few apps touching that, and restrict it to Home and Store, but nothing forbids it technically.

Since accounts contain credentials, they are very sensible documents, this is why we strongly restrict their access.

Technically, it would also be possible to pass the credentials directly to the konnector through an io.cozy.jobs object but I would not advise to do this since the credentials would be stored in clear in the jobs object, contrary to the storage in the io.cozy.accounts where the credentials are stored encrypted.

Do not hesitate to tell us if you succeeded what you wanted to do :slight_smile:

Thanks