davidstrauss / google-drive-recursive-ownership

Tool to recursively give away file and document ownership to another user.
MIT License
268 stars 68 forks source link

Error : Consent is required to transfer ownership of a file to another user. #44

Open Butanium opened 1 year ago

Butanium commented 1 year ago
PS C:\Users\Clement\Documents\Mes-Documents\coding\google-drive-recursive-ownership\google-drive-recursive-ownership> python .\transfer.py "test transfer" *@gmail.com
Changing all files at path "test transfer" to owner "*@gmail.com"
Prefix: ['test transfer']
Use this link for authorization: https://accounts.google.com/o/oauth2/auth?client_id=****
Verification code: ****
User *@gmail.com is permission ID *.
Gathering file listings for prefix []...
Folder: test transfer ([], *)
Gathering file listings for prefix ['test transfer']...
File: empty (['test transfer'], *)
Item b'test transfer\\empty' needs ownership granted.
    Creating new ownership permissions.
An error occurred inserting ownership permissions: <HttpError 403 when requesting https://www.googleapis.com/drive/v2/files/1WAMRlwFeqj5urN2Bl6UhiLgdDzCYfJo98VIKtW5UbRY/permissions?emailMessage=Automated+recursive+transfer+of+ownership.&alt=json returned "Consent is required to transfer ownership of a file to another user.". Details: "[{'message': 'Consent is required to transfer ownership of a file to another user.', 'domain': 'global', 'reason': 'consentRequiredForOwnershipTransfer'}]">
Item b'test transfer' needs ownership granted.
    Creating new ownership permissions.
An error occurred inserting ownership permissions: <HttpError 403 when requesting https://www.googleapis.com/drive/v2/files/1LdEQ0-SFR59U15V5Rt9RNCtdEIdYqUIi/permissions?emailMessage=Automated+recursive+transfer+of+ownership.&alt=json returned "Consent is required to transfer ownership of a file to another user.". Details: "[{'message': 'Consent is required to transfer ownership of a file to another user.', 'domain': 'global', 'reason': 'consentRequiredForOwnershipTransfer'}]">

Granting edit rights to *@gmail.com doesn't fix the issue.

I'm trying give ownership acess from another @gmail.com account

Butanium commented 1 year ago

Seems like the API won't work for @gmail.com account now : https://issuetracker.google.com/issues/228826345?pli=1

Butanium commented 1 year ago

Apparently the process changed and is described in this article https://developers.google.com/drive/api/guides/manage-sharing#transfer-consumer-account

kallewesterling commented 1 year ago

Any updates on this? I am in need of transferring every single file on one of my Google Drive accounts to another, and it's a pain. As it stands, the google-drive-recursive-ownership adds my other user as an Editor but the ownership transfer doesn't work, still, like @Butanium points out above due to the API changes...

Butanium commented 1 year ago

Any updates on this? I am in need of transferring every single file on one of my Google Drive accounts to another, and it's a pain. As it stands, the google-drive-recursive-ownership adds my other user as an Editor but the ownership transfer doesn't work, still, like @Butanium points out above due to the API changes...

FWIW: I think I ended up CTRL+A in the search tab and then transfer the selection

kallewesterling commented 1 year ago

That won't work for me as I'm trying to work with thousands of files.

llang629 commented 1 year ago

This would have been such a useful tool before Google changed the API to require permissions for each change of ownership between consumer accounts.

I considered updating the API calls to follow the new process described here: https://developers.google.com/drive/api/guides/manage-sharing#transfer-consumer-account However, this program would only accomplish step 1.

Another program could be written to accomplish step 2, but it would have to execute with the receiving user's identity.

Otherwise the receiver would just receive a barrage of emails, one per file or folder, asking if they want to become the new owner. If you have enough files to warrant automating this process, wading through all those emails to accept seems to defeat the purpose.

Astonishing shortcoming of Google Drive that it doesn't support recursive change of ownership, since it does support recursive change of sharing.

kallewesterling commented 1 year ago

Agree, @llang629. It means that we're all locked into the accounts that we set up a long time ago :(

svaponi commented 8 months ago

Once completed step 1 (I have a local patch to do that if anybody is interested), then you can fairly easily perform step 2 manually on Google Drive: