V
V
Vladislav Tsepish2018-12-04 14:01:10
Java
Vladislav Tsepish, 2018-12-04 14:01:10

How to determine the e-mail of the current user - on behalf of which work with Google Disk is performed using the Google Drive API?

I am working on an application that works with google drive through the google drive api.
The application works with files and folders. I wanted to sort folders and files into those where the owner is the one on whose behalf the session is created and all others. To do this, I would like to receive the user's e-mail after authorization.
The credential file does not contain this information.
I also did not find a clear answer in the documentation on how to get the e-mail of the current user.
Perhaps someone faced a similar problem.
Authorization occurs using the credential.json file

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2018-12-11
@oshliaer

Don't get me wrong, but I hope you're making a non-public application. Apparently, Google knowingly determines the access areas for authorizing applications.
You don't need to know the username, because credential.json is not used in this kind of applications. Ask the user for authorization and go ahead.
Otherwise. You are obliged to store information about your user (specifically email address) in your system and hope that he will not be able to change his email to someone else's in time with no cunning ass.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question