Where to store PWA app data on OneDrive not to be accessible by user? - onedrive

I want to write a PWA app (to run on Android and Windows 10) working with user's files and photos on OneDrive. I need to store some metadata and I prefer those to be inaccessible to the user.
What are my options?
OneDrive approot special folder is normal folder visible to the user.
I do not want to store the data locally on the device, as I want the app to be run on multiple devices.
I cannot use Windows 10 UWP roaming app data, as they would sync between Windows 10 devices, but not to Android devices.
I do not want to store the data at the PWA's backend, as it would need creating an extra user account. I want the user to log in to their MS Account to access their OneDrive, and to create another account for storing metadata. I prefer the app to be 100% client side.
Are there any other options I missed? I would prefer creating some hidden folder on OneDrive accessible by the app, but by the user. OneDrive does not seem to have such functionality, at least if I read it's API docs properly.

Depending on your exact use case you may want to check out Microsoft Graph:
https://developer.microsoft.com/en-us/graph
Microsoft Graph is an cross-device experiences platform and available for nearly all platforms. Within the Microsoft Graph you can use Activities to share metadata between different devices: https://github.com/microsoftgraph/microsoft-graph-docs/blob/master/api-reference/v1.0/resources/project_rome_overview.md
There is also an demo project on Github of an PWA with usage of the Microsoft Graph:
https://github.com/boyofgreen/MSGraphPWA

Related

Authenticating user without creating app manifest in teams app

Just because of authentication I need to create an app manifest and share the app manifest with users who want to test it .Is there a way to Authenticate user without creating app manifest so that I can directly share bot link with users.
Talking to your bot by ID is intended for basic testing purposes only. Any Teams-specific functionality you have added to your bot fails to work.
Doc ref: Talk to your bot directly by ID
In this example
Is is an OAUTH flow with Azure AD directory v2 without any app manifest.
This one is in java_springboot but you can find the same for your prefered langage in the samples directory. The number 18 (and all the others) in all samples is the example but in different langages.

What a client has to enable to use my app to edit their Google Sheet

Let's say I wrote a simple desktop app that reads some data from a Google Sheet, goes off and finds the answer and comes back and writes it into the Google Sheet. Now hundreds of people have sheets and want to use my program to process them. I post my program and let them download it for free.
Here is the sequence I think the end user needs to follow to get it to work:
1. Go to the GCP console and create a new project
2. Enable the Google Drive and Google Sheets APIs
3. Create a credentials JSON file with access as the Project Editor.
4. Create the Sheet if needed.
5. Copy the email out of the JSON file and Share it in the Sheet.
6. Make sure the JSON file is named right and in the right directory so the app finds it.
That all seems like a lot just so an app can read and write to a Google Sheet. Is there a simpler interface I am missing?
Answer:
There are steps that will always need to be completed when a user runs an application that accesses the Google APIs as themself, however depending on the case some of these may be simplified or circumvented.
More information:
There are a few things that you will need to bear in mind when creating an application for others to use, I'll summarise these points here and explain in a bit further detail:
To use a G Suite API, a Google Cloud Platform (GCP) Project needs to be owned and have the API associated.
In order to use the Google APIs (such as Drive and Sheets) its use must be enabled within the project that will use it.
If a user is running an application as themself, they will need to authenticate the application with their own credentials.
As per Google's documentation for Setting up a project:
Every application that uses Google APIs needs an associated Google Cloud Platform project. This project is a set of configuration settings that define how your application interacts with Google services and what resources it can use.
Resultantly, if your users will be running the application themselves, from a version of the app which is unpublished and not in the G Suite Marketplace then yes - they will need to create a GCP project, enable the respective APIs and use their personal credential file to run your application.
In reality this isn't the way G Suite Applications should be created, distributed and maintained and I can't reccommend that you do it this way. The G Suite marketplace is there to put in place a way of application distribution while removing the need for each user to create a GCP project and authenticate.
Things you can do:
With this in mind, there are a couple of things you can do to which will make the process of what you're doing slightly easier/shorter. Please bear in mind this isn't recommended for application distribution and more for testing purposes:
You can combine points 1, 2 and 3 in your question by having users click the Enable the Google Sheets API button on the Python Quickstart page. This button creates a new GCP project, enables the API and gives a credential file download link in one fell swoop.
Rather than having the user create the sheet themselves, you can code a sheet existence check in your program and create it if it doesn't already exist:
from pprint import pprint
from googleapiclient import discovery
# assuming you already have all your authentication code
sheetsService = discovery.build("sheets", "v4", credentials = credentials)
# add request body to variable sheetBody:
sheetBody = {}
# create the sheet:
sheetsService.spreadsheets().create(body = sheetBody).execute()
The https://www.googleapis.com/auth/drive.file scope allows your application to only access files created by itself which gives your application an extra level of security and trust.
In the sheetBody contents you can imclude the email address of the account running the application, if applicable, by running a Files: list request of the Drive API and reading the owners.emailAddress property of the response, to save reading the address from the JSON file.
References:
G Suite Developer:
G Suite APIs
Set Up Your Project
Build your app
Google Sheets API v4:
Python Quickstart
Google Drive API v3:
Files resource

Store data into google drive's backup tab instead of drive folders

I need to implement same thing like whatsapp storing all chat history to google drive on clicking on backup button in app. And same restore it in new device as required.
I have look for below references for implementing this, but some how I was not able to do it successfully.
https://developer.android.com/guide/topics/data/backup.html
https://developer.android.com/guide/topics/data/data-storage.html
https://developer.android.com/guide/topics/data/data-storage.html#db
Will this data backup option will help in my requirements or I need to do something else?
I successfully developed the file upload to google drive folders, but i need that data in the backup tab of google drive with app name.
can any one guide me how I can implement this or provide me some references?
Thanks in advance..!
You may refer with this documentation. The Google Drive API includes a special hidden folder that your app can use to store application data.
Note: This feature now uses the alias appDataFolder in place of appdata and appfolder.
To be able to use your Application Data folder, request access to the following scope:
https://www.googleapis.com/auth/drive.appdata
For more information about scopes and how to request access to them, see Authorizing Your App with Google Drive.

Porting files from RESTFul to Google Drive Android API(GDAA).

I'd like to solicit an expert advice on the following problem:
I have thousands of files (jpeg images) created under different authorizations in Google Drive. I can see all of them using the RESTful API (DRIVE scope) and can easily collect the file IDs of the subset I need. This collection has to be ported (make visible) to the new app version under the GDAA. And I know that GDAA's 'resource ID' is the RESTful's 'file ID'. I can sure bring all of the files to the Android device (using RESTful API) and re-insert them into the GDAA, but it is wasteful.
So, the question finally emerges:
Having collection of 'resource IDs', is there an easy way to port these files into the GDAA that has FILES scope and its own new authorization identity? Using the Android app only?
If I understand what you are asking, you want to transfer an authorization from one app to another? That is not possible. A user authorized you to access the file with a particular app. They need to reauthorize you to access the file with any new app.

access user arbitrary folders with chrome localstorage API

I'm developing an app on Google chrome which could be able to read and write files to arbitrary folders on the user’s hard drive, such as their My Pictures or My Documents folder.
I want my app to has its one folder, like "Users/Username/App", so users could be able to access some of the data, created and edited by the app. How can I do this?
I read the book "Using the HTML5 Filesystem API", so I know it's actually not possible with HTML5 Filesystem API alone. Same thing was possible by opera 11, 12. (see: http://dev.opera.com/articles/view/file-i-o-api-for-widgets/). Chorome mediaGalleries API do same things but just for media file but I want to use html, xml and office files
It doesn't sound like you've looked at the list of Chrome App APIs. Have you? Among them is the fileSystem API, which is evolving quickly to include directory access.