Paul Fitzpatrick
dd8d2e18f5
(core) add an access token mechanism to help with attachments in custom widgets
...
Summary:
With this, a custom widget can render an attachment by doing:
```
const tokenInfo = await grist.docApi.getAccessToken({readOnly: true});
const img = document.getElementById('the_image');
const id = record.C[0]; // get an id of an attachment
const src = `${tokenInfo.baseUrl}/attachments/${id}/download?auth=${tokenInfo.token}`;
img.setAttribute('src', src)
```
The access token expires after a few mins, so if a user right-clicks on an image
to save it, they may get access denied unless they refresh the page. A little awkward,
but s3 pre-authorized links behave similarly and it generally isn't a deal-breaker.
Test Plan: added tests
Reviewers: dsagal
Reviewed By: dsagal
Subscribers: dsagal
Differential Revision: https://phab.getgrist.com/D3488
2022-07-19 11:55:18 -04:00
..
2020-10-02 13:24:21 -04:00
2021-10-25 10:56:43 +02:00
2020-12-22 22:18:12 -05:00
2020-10-02 13:24:21 -04:00
2022-07-04 10:42:40 -04:00
2022-05-26 15:01:35 -07:00
2020-10-02 13:24:21 -04:00
2022-04-04 14:53:16 +02:00
2022-06-11 00:16:57 +02:00
2021-05-25 21:14:49 +02:00
2020-10-02 13:24:21 -04:00
2022-07-04 10:42:40 -04:00
2020-10-02 13:24:21 -04:00
2020-10-02 13:24:21 -04:00
2021-11-04 01:26:47 +02:00
2021-05-27 17:52:23 -04:00
2022-04-27 22:21:55 +02:00
2021-06-29 15:29:56 +02:00
2022-04-07 20:35:03 +02:00
2022-06-16 23:51:14 -04:00
2022-06-16 21:54:17 -07:00
2020-10-02 13:24:21 -04:00
2020-10-03 22:56:00 -04:00
2022-04-04 14:53:16 +02:00
2022-07-04 10:42:40 -04:00
2022-04-27 22:21:55 +02:00
2020-10-06 13:18:50 -04:00
2022-07-04 10:42:40 -04:00
2022-07-19 08:25:31 -07:00
2022-04-27 22:21:55 +02:00
2022-04-20 17:29:48 +02:00
2022-07-19 11:55:18 -04:00
2020-10-02 13:24:21 -04:00
2022-06-06 09:55:34 -07:00
2022-02-19 09:46:49 +00:00
2022-06-27 16:10:10 -04:00
2022-04-27 22:21:55 +02:00
2020-10-02 13:24:21 -04:00
2020-10-02 13:24:21 -04:00
2020-11-10 10:32:07 -05:00
2022-06-13 11:28:33 -07:00
2022-07-12 08:50:05 -07:00
2020-10-02 13:24:21 -04:00
2022-07-19 16:28:38 +02:00
2022-06-16 23:51:14 -04:00
2022-07-06 09:41:48 -07:00
2021-02-09 09:17:32 -05:00
2021-12-20 19:32:14 +01:00
2020-10-02 13:24:21 -04:00
2020-10-02 13:24:21 -04:00
2020-10-02 13:24:21 -04:00
2020-10-02 13:24:21 -04:00
2022-07-04 10:42:40 -04:00
2020-10-02 13:24:21 -04:00
2020-10-02 13:24:21 -04:00
2022-04-27 00:49:28 -04:00
2020-10-02 13:24:21 -04:00
2020-10-12 16:04:18 -04:00
2022-07-04 10:42:40 -04:00
2022-04-27 22:21:55 +02:00
2020-10-02 13:24:21 -04:00
2022-02-19 09:46:49 +00:00
2020-10-02 13:24:21 -04:00
2022-07-07 17:07:13 +02:00
2020-10-02 13:24:21 -04:00
2022-06-30 17:08:57 +02:00
2022-07-11 14:27:44 +02:00
2022-06-27 16:10:10 -04:00
2022-01-20 19:00:01 +02:00
2020-08-14 13:34:38 -04:00
2020-10-02 13:24:21 -04:00
2020-10-02 13:24:21 -04:00
2022-05-13 09:45:17 +02:00
2021-12-07 14:37:25 -08:00
2020-10-02 13:24:21 -04:00
2022-02-10 12:46:19 +02:00
2022-04-27 22:21:55 +02:00
2022-07-04 10:42:40 -04:00
2020-10-02 13:24:21 -04:00
2022-07-04 10:42:40 -04:00
2022-07-19 11:55:18 -04:00