Skip to content

Commit bdeba63

Browse files
authored
Dropbox connectors: automatic refreshing of expired access tokens (#576)
1 parent fc852b0 commit bdeba63

File tree

14 files changed

+43
-31
lines changed

14 files changed

+43
-31
lines changed

api-reference/partition/api-parameters.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Platform Endpoint parameters
2+
title: Partition Endpoint parameters
33
sidebarTitle: Endpoint parameters
44
---
55

api-reference/partition/chunking.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import SharedChunkingStrategyByTitle from '/snippets/concepts/chunking-strategy-
2929

3030
### "by_page" chunking strategy
3131

32-
Only available in Unstructured API and Platform.
32+
Only available in the Unstructured UI and API.
3333

3434
The `by_page` chunking strategy ensures the content from different pages do not end up in the same chunk.
3535
When a new page is detected, the existing chunk is completed and a new one is started, even if the next element would fit in the

snippets/destination_connectors/dropbox.sh.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ unstructured-ingest \
1717
--partition-endpoint $UNSTRUCTURED_API_URL \
1818
--additional-partition-args="{\"split_pdf_page\":\"true\", \"split_pdf_allow_failed\":\"true\", \"split_pdf_concurrency_level\": 15}" \
1919
dropbox \
20-
--token $DROPBOX_ACCESS_TOKEN \
2120
--refresh-token $DROPBOX_REFRESH_TOKEN \
2221
--app-key $DROPBOX_APP_KEY \
2322
--app-secret $DROPBOX_APP_SECRET \

snippets/destination_connectors/dropbox.v2.py.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ if __name__ == "__main__":
4141
embedder_config=EmbedderConfig(embedding_provider="huggingface"),
4242
destination_connection_config=DropboxConnectionConfig(
4343
access_config=DropboxAccessConfig(
44-
token=os.getenv("DROPBOX_ACCESS_TOKEN"),
4544
refresh_token=os.getenv("DROPBOX_REFRESH_TOKEN"),
4645
app_key=os.getenv("DROPBOX_APP_KEY"),
4746
app_secret=os.getenv("DROPBOX_APP_SECRET")

snippets/general-shared-text/astradb.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ allowfullscreen
1616

1717
An existing collection is not required. At runtime, the collection behavior is as follows:
1818

19-
For the [Unstructured Platform](/platform/overview):
19+
For the [Unstructured UI](/ui/overview) and [Unstructured API](/api-reference/overview):
2020

2121
- If an existing collection name is specified, and Unstructured generates embeddings,
2222
but the number of dimensions that are generated does not match the existing collection's embedding settings, the run will fail.
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
- `<name>` (_required_) - A unique name for this connector.
2-
- `<token>` - The value of the access token for the Dropbox app that is associated with the target app folder.
3-
- `<remote-url>` - The remote URL to the target subfolder inside of the app folder for the Dropbox app.
4-
- Set `recursive` to `true` to recursively process data from subfolders within the target subfolder. The default is `false` if not otherwise specified.
2+
- `<remote-url>` (_required_) - The remote URL to the target subfolder inside of the app folder for the Dropbox app.
3+
- Set `recursive` to `true` to recursively process data from subfolders within the target subfolder. The default is `false` if not otherwise specified.
4+
- `<app-key>` (_required_) - The app key for your Dropbox app. This allows Unstructured to automatically replace expired access tokens.
5+
- `<app-secret>` (_required_) - The app secret for your Dropbox app. This allows Unstructured automatically to replace expired access tokens.
6+
- `<refresh-token>` (_required_) - The refresh token for the Dropbox app. This allows Unstructured to automatically replace expired access tokens.

snippets/general-shared-text/dropbox-cli-api.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import AdditionalIngestDependencies from '/snippets/general-shared-text/ingest-d
1111
The following environment variables:
1212

1313
- `DROPBOX_REMOTE_URL` - The remote URL to the target subfolder inside of the app folder for the Dropbox app, represented by `--remote-url` (CLI) or `remote_url` (Python).
14-
- `DROPBOX_ACCESS_TOKEN` - The value of the access token for the Dropbox app that is associated with the target app folder, represented by `--token` (CLI) or `token` (Python).
14+
- `DROPBOX_ACCESS_TOKEN` - The value of the access token for the Dropbox app that is associated with the target app folder, represented by `--token` (CLI) or `token` (Python).
15+
Provide this only if for some reason you do not want Unstructured to automatically refresh expired access tokens.
1516

16-
To have Unstructured refresh expired Dropbox App access tokens on your behalf, you must also provide the following environment variables:
17+
To have Unstructured automatically refresh expired Dropbox App access tokens on your behalf, do not provide an access token. Instead, provide the following environment variables:
1718

1819
- `DROPBOX_REFRESH_TOKEN` - The value of the refresh token for the corresponding access token, represented by `--refresh-token` (CLI) or `refresh_token` (Python).
1920
- `DROPBOX_APP_KEY` - The app key for the Dropbox app, represented by `--app-key` (CLI) or `app_key` (Python).

snippets/general-shared-text/dropbox-platform.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ Fill in the following fields:
33
- **Name** (_required_): A unique name for this connector.
44
- **Data URL** (_required_): The URL to the target subfolder inside of the app folder for the Dropbox app, starting with `dropbox://`.
55
- **Recursive** (source connector only): Check this box to also process all child folders and their files within the subfolder.
6-
- **Access token** : The access token for the Dropbox app that is associated with the target app folder.
6+
- **App key** (_required_) - The app key for your Dropbox app. This allows Unstructured to automatically replace expired access tokens.
7+
- **Refresh token** (_required_) - The refresh token for the Dropbox app. This allows Unstructured to automatically replace expired access tokens.
8+
- **App secret** (_required_) - The app secret for your Dropbox app. This allows Unstructured automatically to replace expired access tokens.

snippets/general-shared-text/dropbox.mdx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ allowfullscreen
3535
If you do not already have the corresponding refresh token for an existing access token, or if you lose a refresh token after you generate it,
3636
you must generate a new access token and its corresponding refresh token.
3737

38-
For [Unstructured Ingest](/ingestion/overview), instead of continualy replacing expired access tokens yourself, you can have Unstructured do it for you as needed; just supply Unstructured
39-
with the original access token and its corresponding refresh token along with the Dropbox app's **App key** and **App secret** values.
40-
To learn how to supply these to Unstructured, look for mentions of "access token, "refresh token," "app key," and "app secret" in the connector settings later in this article.
41-
42-
For the [Unstructured UI](/ui/overview) or the [Unstructured API](/api-reference/overview), or if you want to otherwise use the refresh token to replace the expired access token yourself, currently you must manually replace expired access tokens.
38+
Instead of continualy replacing expired access tokens yourself, you can have Unstructured do it for you as needed; just supply Unstructured
39+
with the refresh token along with the Dropbox app's **App key** and **App secret** values.
40+
To learn how to supply these to Unstructured, look for mentions of "refresh token," "app key," and "app secret" in the connector settings later in this article.
4341
</Warning>
4442

4543
3. The app folder that your Dropbox app will use for access can be found in your Dropbox account under the `Apps` top-level folder. For example, if the value of the **App folder name**
@@ -66,7 +64,7 @@ allowfullscreen
6664

6765
Dropbox app access tokens are valid for **only four hours**. After this time, you can no longer use the expired access token.
6866

69-
To replace an old, expired access token with a new, valid one, do the following:
67+
To have Unstructured automatically replace expired access tokens on your behalf, do the following:
7068

7169
1. Get the app key and app secret values for your Dropbox app. To do this:
7270

@@ -101,16 +99,25 @@ To replace an old, expired access token with a new, valid one, do the following:
10199

102100
7. In the response, copy the following two values:
103101

104-
- The value of `access_token` (starting with the characters `sl`) is the new, valid access token. In your Dropbox connector settings, replace the old,
105-
expired access token value with this new, valid access token value.
106-
- The value of `refresh_token` is the refresh token that you can use to replace this access token much faster and easier next time.
102+
- The value of `access_token` (starting with the characters `sl`) is the new, valid access token.
103+
- The value of `refresh_token` is the refresh token that can be used to replace this access token much faster and easier next time.
107104
If you lose this refresh token, you must go back to Step 2.
108105

109-
For [Unstructured Ingest](/ingestion/overview), if you want Unstructured to use this refresh token to automatically replace the expired access token instead of replacing it yourself, then
110-
simply supply Unstructured with these `access_token` and `refresh_token` values, along with the `<app-key>` and `<app-secret>` values
111-
as described earlier in this procedure, and then stop here.
106+
For the [Unstructured UI](/ui/overview), if you want Unstructured to use this refresh token to automatically replace the expired access token instead of replacing it yourself, then
107+
add the following values to your connector settings, and then stop here:
108+
109+
- Add the `refresh_token` value to the connector settings **Refresh token** field.
110+
- Add the `<app-key>` value to the connector settings **App key** field.
111+
- Add the `<app-secret>` value to the connector settings **App secret** field.
112+
113+
For the [Unstructured API](/api-reference/overview) and [Unstructured Ingest](/ingestion/overview), if you want Unstructured to use this refresh token to automatically replace the expired access token instead of replacing it yourself, then
114+
add the following values to your connector settings, and then stop here:
115+
116+
- Add the `refresh_token` value to the `refresh_token` parameter.
117+
- Add the `<app-key>` value to the `app_key` parameter.
118+
- Add the `<app-secret>` value to the connector settings `app_secret` parameter.
112119

113-
8. For the [Unstructured UI](/ui/overview) or the [Unstructured API](/api-reference/overview), or if you want to otherwise use the refresh token to replace the expired access token yourself, make the following REST API call, replacing the following placeholders:
120+
8. If for some reason you need to manually replace the expired access token yourself instead of having Unstructured do it for you, you can use the refresh token that you just copied to get a new access token:
114121

115122
- Replace `<refresh-token>` with the refresh token.
116123
- Replace `<app-key>` with the app key for your Dropbox app.

snippets/general-shared-text/pinecone.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
An existing index is not required. At runtime, the index behavior is as follows:
1717

18-
For the [Unstructured Platform](/platform/overview):
18+
For the [Unstructured UI](/ui/overview) and [Unstructured API](/api-reference/overview):
1919

2020
- If an existing index name is specified, and Unstructured generates embeddings,
2121
but the number of dimensions that are generated does not match the existing index's embedding settings, the run will fail.

0 commit comments

Comments
 (0)