How to set box api id as an owner for an existing folder?
Hi,
Just want to know is it possible if I want to transfer the folder owner to an box app id? Don't want to use the Box API to create new folders, some user are using the folder already.
Thanks.
-
yes, you could use a JWT application to create an app user (or use the service account) and then make that user the owner of the folder.
- Create a JWT app https://developer.box.com/guides/applications/custom-apps/jwt-setup/
- Using JWT, get the current user's ID https://developer.box.com/reference/get-users-me/
- Next, use the As-User header to act act the original owner of the folder https://developer.box.com/guides/authentication/jwt/as-user/
- Then, as that user create a collaboration, inviting the service account of the JWT app using it's user ID https://developer.box.com/reference/post-collaborations/
- Then, still as the same user, update that collaboration to give the service account the "owner" role https://developer.box.com/reference/put-collaborations-id/#param-role
Now, all users still have access to the folder, but a new user has been added that belongs to a JWT application, and that user is now the owner.
You can learn more about users, app users, and service accounts here.
https://developer.box.com/guides/authentication/user-types/app-users/
-
Hi , The app is Enterprise Integration app, and set the OAuth 2.0 with JWT (Server Authentication), and I'm using the Python SDK. From the link, the curl it ask ACCESS_TOKEN , and now I can only use the json file for the authorization, not sure where to get the access token, can not goto the next step, could you please give some advice? Just want to transfer the folder owner to the box service account id, thanks.
Please sign in to leave a comment.
Comments
3 comments