共享实时文档 [英] Sharing the Realtime Documents

本文介绍了共享实时文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个游乐场应用程序。我发现它在我的谷歌驱动器中创建了快捷方式文件。我试图分享它与隐身(因为我希望文档可供任何人使用,不知道如何创建另一个谷歌帐户,所以我登录到隐身)。共享链接看起来像 https://drive.google.com/open?id=0B00--A0eRH1JLTdsX2t0LWw5RE0 。但是,隐身没有看到它。它说,预览avaialable在应该是它的谷歌驱动器窗口,并提供登录





我看到的关键问题是游戏应用程序具有以下结构,它来自官方演示



<$
函数onFileLoaded(doc){display(doc)}
gapi.drive.realtime.load(your_doc_id,onFileLoaded)
}

//应用程序入口点 - 以授权开始
gapi.auth.authorize({
client_id:rtClientId,范围:['install','file'],
// user_id:userId,
immediate:!popup},onAuthorized
);

在显示任何文档之前,似乎首先要求验证。对于我希望我的应用程序可用的未签名模式,授权是有问题的。我想共享一个文件,并使其可供公众查看,而无需登录。如果隐身用户能够查看或事件编辑我的文档,这就产生了一个问题。如果需要,我还会关心如何将文档复制到他们的帐户:一件事是,当您使用我的应用程序在驱动器上创建了一个文件时,可以列出这些文件并使用 drive.copy api复制所需的一个和其他东西,当你想复制一个文件,而不是在你的谷歌驱动器上可用,你唯一的东西是它的ID。

顺便说一下,你能告诉我哪个帐户用于其他帐户的非隐身测试吗?如果我在一个帐户中创建文档,我想看看它是如何看起来/从另一个帐户访问的。

解决方案

默认情况下,Realtime API不提供匿名访问。请参阅 https://developers.google.com/google-apps/realtime/faq# do_the_realtime_api_support_anonymous_access


I have created a playground application. I see that it creates shortcut files in my google drive. I tried to share it with incognito (because I want the doc to be available to anybody and do not know how to create another google account, so I log out into incognito). The shared link looks like https://drive.google.com/open?id=0B00--A0eRH1JLTdsX2t0LWw5RE0. But, incognito fails to view it. It says that "No preview avaialable" in what is supposed to be its google drive window and offers the log in

The key problem that I see is that playground application has the following structure, which comes from the official demo

function onAuthorized() {
    function onFileLoaded(doc) {display(doc)}
    gapi.drive.realtime.load(your_doc_id, onFileLoaded)
}

// App entry point -- start by authorization
gapi.auth.authorize({
    client_id: rtClientId, scope: ['install', 'file'],
    //user_id: userId,
    immediate: !popup }, onAuthorized
);

which seems to demand authentication in the first place before displaying any doc. Authorization is problematic for the unsigned mode that I want my app to be available. I want to share a file and make it viewable to the general public, without the need to log in. This raises a question if incognito users are able to view or event edit my document. I also concern how to copy the doc to their account if desired: one thing is when you have created a file on your drive with my app, you can probably list the files and use drive.copy api to copy desired one and other thing when you want to copy a file that is not available on your google drive and the only thing you have is its id.

BTW, can you tell me which account to use for non-incognito testing from another account? If I create the document in one account I want to see how it looks/accessible from the another.

解决方案

The Realtime API does not provide anonymous access by default. See https://developers.google.com/google-apps/realtime/faq#does_the_realtime_api_support_anonymous_access

这篇关于共享实时文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆