I need to share files with others so that they can see and edit my google docs without logging into google.
I created correctly permissions for writing for "anyone with the link", and I can only view that file as not logged into google because I don't have an edit button, that button is only visible for logged-in users.
For the spreadsheet I resolved this problem, because the edit link is always the same, with google-file-id
like this: https://docs.google.com/spreadsheets/d/
{33_character_google_id}/edit
But for other files, the edit link looks like this: https://docs.google.com/document/d/
{44_character_hash}/edit
I have no idea where this hash is coming from
Is it possible to prepare that hash or get him from API?
The problem was more complicated than I thought.
I didn't get webLink from DriveFile
in response after upload, and also I was getting an object with webViewLink
only for read after download - I don't know for what reason.
But the solution was to download webViewLink
by this one line of code:
$this->googleServiceDrive->files->get($googleId, ['fields' => 'webViewLink'])
(BTW I have read somewhere that webViewLink stores edit link if edition is possible by google editor, and stores read link if not).