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
Create custom browser window and parse DocumentTitle property
Navigate user's browser and ask him to copy-paste code from title (or do it automatically)
You may download an example from here
Just fill CLIENT_ID and CLIENT_SECRET constants.
Related
So I am making a program to upload YouTube videos to my clan channel so that I can distribute it to the other clan members and everything is all set...
They open the program, they browse the file, set the title, the privacy and press Upload. DONE
If they want they open the thumbnail changer, browse for the thumbnail press Upload. DONE
It works great!... In my computer, how can I make it that it works for everyone? because everytime I share it with one of the members... it doesn't work because they need to login using OAUTH (to one of their accounts).
Thanks for helping!
I'm coding in C# but that is not relevant at all.. by the way I've already tried older methods present in the API but it returns invalid request.
There is no way to use the YouTube API without Oauth. If you want to access private user data you need to have the permission of the user who owns the data.
Your only option would be to authenticate your code once and store the refresh token and use it when the others want to access your data. If you are using Google .net Client library check filedatastore its storing your refresh token.
Here is the code for uploading videos to youtube without OAuth, You only need API key, Username, Password.
https://developers.google.com/youtube/2.0/developers_guide_dotnet?csw=1#Direct_Upload
Basically the idea of the program is as follows: The user enters their email account and password google drive, then select the file and click upload button.
Can this be done?
Yes, but you have to have an embedded browser to handle the authentication using OAuth, as the client will need to enter their credentials into the Google login page. A previous answer here How to publish Google Docs in .NET? also indicates there is a .net library (which I havent tried) that might help.
I have a problem. I use C# .Net 2013 Windows Form Application. I want to upload to Google Drive the file of the user selected.(The user cannot have a gmail account.) The project can work in any copmuter as .exe. However, the project wants to login in each case when I try. When I logged in, the project wants to allow from me. I don't want to this. Users will select the files they want to send and after that they will click on the send button. Users should not see any question. The selected file should be sent automatically. How can I do this?
Thanks for your help. Emrah.
It sounds like you want end users to upload files to a single Google Drive account. In that case you should probably look into using a Service Account, which allows the application to have it's own account without prompting the user for authorization.
I am developing an c# application to upload videos to youtube from my local drive to different accounts. Currently I am not using youtube API to upload the videos and I use webclient class & a google developer key to do it. I am able to upload the videos successfully to the account which is associated with the developer key. However when I use the credentials of different youtube account it's not able to upload and I get the error
"Currently authenticated user does not have write access to username myusername"
I am not sure about the cause of this error. Or is it that do I need to change any settings in the youtube account to enable the access for the application to upload videos? I assume I need to use the youtube API to do it. Are there any other methods to upload a video to different youtube account by providing the username and password with my developer key?
The problem was wit the url to upload to a comment.
Thanks.
I have no idea what the "webclient class" you refer to means. You should be using the official YouTube API if you're programmatically interacting with YouTube.
The correct way to handle uploads is to use the username "default" when constructing your upload URL, as described at
https://developers.google.com/youtube/2.0/developers_guide_protocol_direct_uploading
This will ensure that the upload goes into the account associated with the current authorization token.
There's sample code to do this using the .NET client library available at
https://developers.google.com/youtube/2.0/developers_guide_dotnet#Direct_Upload
I have written an application that maps a user's SkyDrive to a network drive.
However when opening word documents directly from the network drive, Microsoft Office 2010 tries to load the document using WebDav and prompts for the user to login in again.
When you login it works fine, and if you click "Remember Me" it stores the credentials in the credential store, accessible via rundll32.exe keymgr.dll, KRShowKeyMgr
This only lasts until the session is closed.
I want to incorporate the automatic storing of the user's credentials into my program so that the user doesn't get prompted at all.
I have tried using the CredWrite API however that only allows me to store generic credentials. I need to store a (.Net Passport) credential.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa375187(v=vs.85).aspx
I have only been able to achieve this using the CredUIPromptForCredentials API with the flags set to CREDUI_FLAGS_SERVER_CREDENTIAL
http://msdn.microsoft.com/en-us/library/windows/desktop/aa375177(v=vs.85).aspx
I have inspected the API call that word makes to credui.dll and it is identical to the one I am calling (aside from some captions).
But it produces different results.
My code produces this credential to be saved
The word api call/subsequent code produces this credential
However I cannot figure out how to get the credential target to save correctly so that office will load it without prompting. I'd prefer to even have the prompt load if there is no option as I can pre fill the username and password so that the user just has to click OK but I'd like to do it silently.
Additionally if there is anyway to disable word's WebDav support/force it to use the network drive as an actual network drive that would also work. I have been unable to find any answer. If anyone has any idea I would greatly appreciate it.