Offline file support in OneDrive API via .NET - c#

Is there some concept implemented in Microsoft Graph OneDrive API that I can leverage for offline files from C#?
I would like to store user files for my app in OneDrive yet this should be also possible when the user is offline. As soon as she goes online there should be some synching going on and files get downloaded/uploaded as needed.
EDIT
How is the scope wl.offline_access related to this topic? It sounds promising, but there is little info about it. I suspect it is about using OneDrive while being online but not being signed in. Then it would not be a solution for me. Is this correct?

You certainly could do this with Graph but you would need to handle tracking and syncing changes within your application. I would highly recommend directing your users to use the OneDrive app rather than attempt to replicate this functionality on your own. Building a fully functioning sync client is non-trivial endeavor to put it mildly.
The offline_access scope is used to obtain a Refresh Token so that your server can continue to operate on behalf of the user without requiring the user to be online.

Related

Which cloud storage (dropbox, googledrive, ?) able to be accessed by multi user without Oauth authentication

I want to create a mobile app (xamarin form, c#) that access a cloud storage to store my files like .csv and images which are read only by users.
I could then update the data/files in the storage, and make it available to all users.
I don't want my users to authenticate by using their account.
I expect that the app know how to connect and access to my account (i.e. my dropbox account or gdrive account) in background. It will be seamless to the user.
In short, I would like make my dropbox or gdrive or other clouds files, able to be seen by all users via my app
I tried dropbox and gdrive, but it seems like they use Oauth which require users to login to their account, I don't want that.
Any recommendation or some insight for me?
Thanks a lot stackoverflow
If you want to store user information in the cloud service in any way, Google Drive may be the best choice.
The following address describes all the requirements for integrating the application with Google Drive
https://developers.google.com/drive/api
In Google Drive, you will receive an API key through which your application will upload and download files, and you do not need to create an account for the application's uses or personally authentication.
To use, it is enough to be able to call a rest API
and here it is the API reference:
https://developers.google.com/drive/api/v3/reference

Microsoft Graph API - Get photo

My company has an internal application where I need to pull/display pictures of all the employees from office 365 with out user intervention.
From what I read online I think I need to call Microsoft graph getphoto API in daemon application to achieve this as per this link (https://developer.microsoft.com/en-us/graph/docs/authorization/app_only).
Will this be a right approach? If yes please point me to any C# sample codes related to this.
Appreciate your responses.
Yes, this is exactly the type of application you will want to build. App-only (machine-to-machine) authentication should be used anytime you don't need a user present to execute functionality.
You can take a look at the ASP.NET Core App Only sample to get a sense of how to register and set up your app to use app-only authentication. The sample goes on to use this access token to set up webhooks, but you can replace this logic with your custom code. You will want to select the scope User.ReadBasic.All to have access to users' profile photos.

How to share cookies between 2 windows accounts

Is anybody knows how to share cookies between 2 windows users?
I have a Windows 10, where have 2 users: one is admin and second is operator.
Admin is logged in into the system and then goes to the web site, where setup some config. In this config we have some specific value which should be store locally in machine and operator shouldn't know nothing about it. So he is set some kookie { someKey: someValue } and then log out from Windows.
After this operator log in into Windows and open the same website and he should have access to this cookie { someKey: someValue }.
I search around we and found nothing about it. Found only solutions about save to file system, send via tokens and save MAC address with a value into DB. But this is not suitable for me. I know that share cookies and store locally isn't secure, but need to implement that feature.
Web project based on chrome browser, asp.net mvc, angularjs and ms sql for db storage. Is anybody can help me with this issue about cookies?
There is no way to do this. First, every browser has its own way to store and retrieve cookies. It is impossible to write something that will work for any platform and any version.
Second, there is security. You can't just copy some files and expect this to work. Browser developers aren't stupid to leave such a big security loophole in their software.
You are mixing Windows applications with full control over the system with a web application that only resides within the browser. You should find a better way. You could use a certificate installed on the machine to validate the user, but it seems to me there are better options, like simply logging in, etc.
Cookies are a browser component that all major browsers locate in user specific directories. if you could change it to HTML5 storage API and you could setup the storage to a folder both users have access (dunno about this). You could have client side shared data. Most probably, you could not. And certainly not using cookies.
Disclaimer: I havent used storage API
Edit: Just checked. Storage API does store the data un user specific folders, so cannot use it either.
"In practice, "client-side storage" means data is passed to the browser's storage API, which saves it on the local device in the same area as it stores other user-specific information, e.g. preferences and cache. Beyond saving data, the APIs let you retrieve data, and in some cases, perform searches and batch manipulations." Source: https://www.html5rocks.com/en/tutorials/offline/storage/

Can I use YoutubeAPI to create live events with different user

As far as I know, when I developed a console app using YoutubeAPI to create live events for streaming, youtube required me to choose the account which was enable live streaming to put live events on.
But when I developed a website app using that API, even though I opened icognito browser to create live events, it still used my first account in Chrome to create live event.
I wondered if there is some way to make this API to select user like what happened in console app.
I think it is because of the client_secrets.json but I don't know how to fix it.
I am using C# to develop
All of the Live Streaming endpoints require OAuth, you must be authenticated as the user you wish to stream live with. You cannot stream on another user's behalf unless they have logged in and provided a valid OAuth token to use for your requests.

How to have each user with their own API limits?

The project I'm working on is a set of tools for users to manage their own accounts. For example, generic users will be able to access and update their Drive or calendars, and for administrators they can additionally get lists of their users and groups and manage those.
My concern is the API limits. At this point in time the project's client ID and secret are hard-coded because I want users to just be able to download and run the tools (which is working great until someone queries all users and uses up half of the daily limit for one of the APIs). I realize I can request more API calls, but I'm not sure that's the best solution.
In order to have each user on their own API limits, will I need to have each person using it set up a new Google Code project with its own set of limits? Or is there a way to allow the same project to have limits based on domain? I'm not sure what best practice is.
Edit: I should mention I'm authenticating via OAuth2.0 using 2-legged authentication, as my understanding was that was the best way to do it for administrators and users... should I be using 3-legged instead?
This is (probably) not an answer, but ...
A good question is precisely what is an "app". In this answer What is the limit on Google Drive API usage?, Nivco from Google says "Currently for the Drive API it reads "Courtesy limit: 10,000,000 queries/day". It's a per app quota"
and on the API Console, your project can consist of many "apps", each with its own client ID.
So, either (a) the term "app", being ill-defined, is being used incorrectly, or (b) you can achieve what you are looking for by creating multiple apps within your project.
Sadly, I suspect it's (a), but might be worth confirming.

Categories