Determining sharing settings of Google Document by link

In our application users can submit a link to a Google Document (from Google Drive). We want to be able to check whether the document is shared in a way where anyone with the link can access the document. How is that possible (preferably using Javascript).

Such a link could be: https://docs.google.com/a/peergrade.io/document/d/1_PgKkr7e4E1uEE4O_SHswq4tjBDLthg0KxGXjtIMLio/edit?usp=sharing
which is not shared for external people.


Source: stackoverflow-javascript