So I am not sure if it is possible and if it is making sense at all. I am trying to learn and use cloud space in my application. So as a sample I was trying to create an application to upload files in Google Drive. I registered my application and used some references given by Google. And I am able to upload files now.
I registered my app using myname@gmail.com
and used Client_Id
and Client_Secret
given in my account to create the app. When I upload the files, files get uploaded to my myname@gmail.com
account. But what I want is, my app should give an option to user to login into there gmail
accounts. Whoever logs in (say with email your@gmail.com
), my app should be able to upload files to there account. I believe offline Google Drive app for desktop works the same way. Enter your username and password and files will sync to that account. Can anyone point me to a sample code please?
I want to upload files, read them, delete them, share them through my app. I am not giving any code sample, but if its needed let me know. Thanks.
You can do it. You will need to navigate user to a specific URL, where he will input his email and password. After that Google will give you authorization code and refresh token. Refresh token can be used to retrieve authorization code whenever it is expired. This authorization code is used to work with user drive.
If your application is a web application you may navigate user to google and set callback to your custom URL. If it is a windows forms application, then you have 2 options
You may download an example from here
Just fill
CLIENT_ID
andCLIENT_SECRET
constants.