Sharing the Realtime Documents

橙三吉。 提交于 2020-01-17 06:10:09

问题


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.


回答1:


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




回答2:


"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."

Use Chrome for one account. Use Firefox and other browsers for succeeding accounts.

Additional note:

Just so you have a clear understanding what Incognito is all about. What it can and cannot do so you don't mix things up.

How incognito mode works

What you view

Incognito is a mode that opens a new window where you can browse the Internet in private without Chrome saving the sites you visit. You can switch between an incognito window and any regular Chrome browsing windows you have open. You'll only be in incognito mode when you're using the incognito window.

Be careful. Incognito mode only prevents Chrome from saving your site visit activity. It won't stop other sources from seeing your browsing activity, including:

Your internet service provider Your employer (if you're using a work computer) The websites you visit themselves What you've downloaded

Chrome won’t save a record of the files you download in incognito mode. However, the downloaded files will be saved to your computer’s Downloads folder, where you and any other users of your computer can see and open them, even after you close your incognito tabs.



来源:https://stackoverflow.com/questions/38354278/sharing-the-realtime-documents

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!