How to let anonymous users edit a Google Drive Realtime document? - javascript

I want to create a web page that uses Google Drive Realtime API that allows users to anonymously edit several text fields. Because more than one user may be accessing the page simultaneously, I want to prevent someone's edit from being overwritten by another user without the first editor knowing that his edit is overwritten.
However, from the quick start, it seems that authorization using Google Account is needed for people to start editing. Is it possible to let arbritrary user edit my realtime model, without the need of logging in? Something similar to letting a Google Docs Spreadsheet be edited by the public.

Right now only psuedo-anonymous mode is available. You can make files available publicly, or to anyone with a link. However, the user will need to log in with a Google account in order to edit.
They appear as an anonymous user to the other users in the document. This is where isAnonymous is currently used.

I have confirmed that this is possible. Right click the document in Google Drive, and click Share... In the dialog that opens, click the drop down and select Anyone with the link can edit. Give the shareable link to whomever you need and they will be able to edit.

From a brief look at the documentation it may be available however I was unable to find anything allowing anonymous users (it seemed to require oAuth 2.0 with G+ to work). In regards to your second part, controlling users editing parts based on consent is going to get very quickly and I am unsure if you would be able to do it easily. If you want features as complex as these you may just have to implement your own realtime editing features (or try and leverage the google realtime api in some indirect way.

Related

Hosted React app track clicks with uniques session without user interaction

I know not exactly how to ask this appropriately and where. I tried searching around and visited various (paid) solutions, but I would require a simple solution.
For a scientific work of mine I want to track user interactions or basically button clicks on a simple React site like this example I made http://flock-1401.students.fhstp.ac.at/
Assume the user visits the provided link above, then I want to create a log on a server (maybe nodejs self-hosted) where the user's interaction is tracked with a unique session to distinguish them. At most, there will be 150 users active.
I tried to use the following library:
https://github.com/react-ga/react-ga
However, I tend to not use Google Analytics as I don't need all the included stuff there. Maybe something like this https://github.com/greenstick/interactor? But how do I automatically save it then?
Thank you

Can I associate a user's account with an action to the drive API?

We're looking to make a little webapp to manage our week-long nerf war (humans vs zombies to be precise), and we're thinking about how easy it would be to have Google Sheets be our only backend, and our frontend be entirely javascript/html/css.
Let's say there's two actions that can be done in this javascript:
Register, which adds a row to a certain sheet.
Report tag, which adds a row to another sheet.
Let's say we have 100 players. We'll have each player sign in using a google account. Is there a way that for either of those above actions, we can have sheets know who made that action?
This way, if someone gets hold of the API key and spoofs their referer to make bad requests, then we can know which google account did it and ban them from the game.
For example, if I open up my sheet and say "see revision history", I want to not see one user for all the revisions, I want to see the user who triggered the action.
Is this a reasonable approach, and is it possible? Thanks!
(note: i know these two actions can be done via google forms, which can associate the user's account, but imagine we have more complex actions that cant be achieved with just a google form)
The short answer is no. You'll be using the spreadsheets API (NOT the Drive API) to update the sheet.As far as Google is concerned, the "user" is your application, regardless of which human was driving the application at the time. Your application knows who the human is, and so it is responsible for logging any audit info that your use case may require.

How to submit a form internally?

I am curious about submitting a form data internally.
Here is an example.
I want to register an account for a website. The website will give a form to register which upon submitting will create an account for me.
But I don't want to go to that site. Instead I'll give a form in my style and collect the same information. Upon submit, I want to create the account automatically. Automatically in the sense, I'll submit the form internally.
The reason why I need this feature is, I don't want my users to create a separate account in another website also. I mean it should save user's time in creating account only. Rest of the things will be taken care by me.
Please let me know if anyone had tried this and had success.
I know it is very difficult for existing accounts and some internal errors. But I also need to track them.
Please let know if this is possible or not.
An Example
There is site called othersite.com which has a form for creating / registering users.
I will a similar form to the user on mysite.com. But upon submit the form information is sent to both mysite.com and othersite.com. Both sites create accounts parallelly with a single form submission.
Unless you are working with AJAX requests and CORS enabled sites, which I assume is not the case, client side technologies ( browser/javascript ) will not help you much to do that.
You have to ask yourself what are the options to integrate with the second site in order to automatically create the account. Following some common patterns used these days:
REST API: You have an url where you can use HTTP to talk to and ask to create the account. Many social networks and other popular services usually expose it. Facebook API
Database: Although it is less recommended you could just insert a new record into the account table if you own and have access to the database used by the second site.
Client Libraries: Some sites provide client libraries so that you can use them together with your project code base. Eg: Twitter Libraries

Facebook how to create button that share content with 1 click?

I have seen on many websites who have a button. That share a story to yours facebook profile when you click on it. I have tried the Facebook Share button, but a dialog appears.
How do I create a Facebook share button that share content with only 1 click?
you need to use open graph api in Facebook or add meta tags in the <head> </head> of your pages, where your share button is placed.
look at this section, Sharing Rich Media
But you should use Like button instead, Share button is deprecated by Facebook.
Facebook has many restrictions concerning sharing content. There are a few roadblocks to one-click sharing.
What you tried used the Feed dialog, which is the easiest way to share content to a user's profile or timeline. However, this brings users to a Facebook.com url where they must approve the content and enter their own message. You can set certain parts of what is shared (URL, title, description, etc), however under most circumstances you may no longer set the message that is shared. See http://developers.facebook.com/docs/reference/dialogs/feed/ for more details.
On the other hand, you can use Facebook Auth to publish to a users stream using the publish_stream permission. However, this is an advanced technique that requires extra work on the part of the developer. You must create an application, allow the user to login, and request the publish_stream permission from the user. After gaining permission, publishing to their stream can be accomplished with 'one-click,' or by simply using using javascript or server-side code.
The simplest solution is obviously using the Feed dialog, which is two-clicks, but a whole lot easier than Authentication.

How do I find out if my Open Graph app has already been added to the Timeline programmatically?

Assume, that besides using the "Add to Timeline" Social Plugin I want to show a specific message to the user only if she did not yet add my app to her Timeline.
Is there any method in the JavaScript SDK that lets me check for that?
According to what i have read, add to Timeline plugin is available through the Javascript SDK via the XFBML tag.
https://developers.facebook.com/docs/reference/plugins/add-to-timeline/
There doesn't seem to be a call that we can subscribe to at the moment.
There is no coverage of how to read from the timeline via the various APIs [yet].
However you can capture and save the ID of any post made, store that in your local database and use it to reference off of either for determining what to share or to let them delete previous posts.
This is a good practice even if the ID doesn't help you as both Facebook and the user want you to be transparent in your posting and the management of said posts.

Categories

Resources