Skip to content
Snippets Groups Projects
Commit 4095031d authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

Add a secret to remote doctype

parent 1fda746b
Branches
No related tags found
No related merge requests found
...@@ -129,3 +129,16 @@ const result = await client ...@@ -129,3 +129,16 @@ const result = await client
``` ```
If you wanna know more about remote doctypes and how to store and use secret tokens, please refer to the official cozy documentation. If you wanna know more about remote doctypes and how to store and use secret tokens, please refer to the official cozy documentation.
## Add secrets to a remote
As above, you can pass a _{{secret_token}}_ to your remote doctype. In local, you can directly pass it as a request param in _io.cozy.doctypes/org.ecolyo.usage_.
Otherwise, you will have to add it in the shell script _easy-cozy/db-init.sh_ on the server. You can add the following line to the file in order to add the secret in the database :
```
docker-compose exec db curl -X PUT -d "{\"_id\":\"org.ecolyo.dju\",\"token\":\"${API_DATAGRANDLYON_TOKEN}\"}" http://127.0.0.1:5984/secrets%2Fio-cozy-remote-secrets/org.ecolyo.dju
```
Make sure you have the right remote doctype name as \_id.
Then, in the .env file, just add your token variable.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment