Explain How to Access Files via a Service Account
We've bounced around the documentation and can't seem to find a simple, clear answer of how to access Box files via a service account. We're able to authenticate via JWT token, but there are no folders or files coming back. I don't see how to grant file permission or visibility to the service account.
Please explain what exact steps are necessary to make a service account see all existing files. We're using .NET Core C#.
-
Hey Jon,
We're actually in the works of improving our documentation on this topic, so thank you for the callout!
Just like when Box.com directly, you're only going to be able to successfully make API calls to content the user associated with your token either owns or has collaborator access to. Therefore, you're going to need to get the email address of your JWT apps (AutomationUser) service account and add it as a collaborator on the content you'd like it to have access to. To obtain this email address you can use the get current user endpoint. If you're using our .NET SDK here are some links:
- get current user
- add collaborator (you'd need to use a token for someone who already has access and can invite collaborators to the content)
You also mentioned, that you may want this user to have access to all content, which could be a lot of work using the above depending on the amount of content we're talking about. Therefore, you may want to take a look at the Global Content Manager scope, which would allow the service account token to access content it does not own/have access to without doing the above.
I hope that helped clarify, but please let me know if you need further assistance :)
Best,
Kourtney
Box Developer Advocate
サインインしてコメントを残してください。
コメント
1件のコメント