Skip to content

Commit d404b12

Browse files
tobiceTC-MO
andauthored
feat(platform): explain permission dependencies for scoped tokens (#1200)
Dependencies are tricky and can confuse users. Let's have them explained in the docs. Related Slack discussion [here](https://apify.slack.com/archives/C05V6DJRWPJ/p1725632208478389) and [here](https://apify.slack.com/archives/C05V6DJRWPJ/p1725371887164209). Related issue: apify/apify-core#17384 --------- Co-authored-by: Michał Olender <[email protected]>
1 parent 712b46d commit d404b12

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
41.4 KB
Loading

sources/platform/integrations/programming/api.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,29 @@ This is useful if you want to for example create a token that can dynamically cr
9090

9191
:::
9292

93+
### Permission dependencies
94+
95+
Some permissions require other permissions to be granted alongside them. These are called _permission dependencies_.
96+
97+
#### Automatic dependencies
98+
99+
The form enforces certain dependencies automatically. For example, when you grant the _Write_ permission for a dataset, the _Read_ permission is automatically selected. This ensures that you can write to a dataset if you can also read from it.
100+
101+
![The Write permission depends on Read for a dataset](../images/api-token-scoped-dependencies.png)
102+
103+
#### Manual dependencies
104+
105+
Other dependencies are more complicated, and **it is your responsibility that the token is set up correctly**. Specifically:
106+
107+
- To create or update a Schedule, the token needs access not only to the Schedule itself, but also to the Actor or task that is being scheduled.
108+
- Similarly, to create or update a task, the token needs the additional permission to access the task's Actor itself.
109+
110+
:::tip
111+
112+
Let's say that you have an Actor and you want to programmatically create schedules for that Actor. Then you can create a token that has the account level _Create_ permission on schedules, but only the resource-specific _Run_ permission on the Actor. Such a token has exactly the permissions it needs, and nothing more.
113+
114+
:::
115+
93116
### Actor execution and scheduling
94117

95118
When you run an Actor with a scoped token (or schedule one), Apify will inject a new, _unscoped_ token to the Actor. This means that **the Actor will have full access to all resources in your account**.

0 commit comments

Comments
 (0)