marx-yu / WopiHost

Office Online Server Wopi Host implement, No need Cobalt. Support DOCX, XLSX, PPTX online editing.
BSD 3-Clause "New" or "Revised" License
247 stars 94 forks source link

WOPI Host url error #1

Closed rchcomm closed 9 years ago

rchcomm commented 10 years ago

Usage & Examples

http://[owas.domain]/we/wordeditorframe.aspx?WOPISrc=http%3a%2f%2flocalhost%3a8080%2fwopi%2ffiles%2fword.docx&access_token=[token]&ui=zh-CN

http://[owas.domain]/p/PowerPointFrame.aspx?WOPISrc=http%3a%2f%2flocalhost%3a8080%2fwopi%2ffiles%2fppt.pptx&access_token=[token]&ui=zh-CN

http://[owas.domain]/x/_layouts/xlviewerinternal.aspx?WOPISrc=http%3a%2f%2flocalhost%3a8080%2fwopi%2ffiles%2fBook1.xlsx&access_token=[token]&ui=zh-CN

==>

http://[owas.domain]/x/_layouts/xlviewerinternal.aspx?WOPISrc=http%3a%2f%2flocalhost%3a8080%2fwopi%2ffiles%2fBook1.xlsx?access_token=[token]&ui=zh-CN

&access_token =====> ?access_token

-- Example site url -- https://github.com/rchcomm/WopiHost/blob/master/README.md

marx-yu commented 10 years ago

No, access_token is the second parameter of [owas.domain]/we/wordeditorframe.aspx, not the parameter of wopihost. it will received by owas first, and owas pass this parameter to the wopihost for authentication when call the wopisrc url.

kmkmahesh commented 9 years ago

how to create access_token

and i need an asp page to edit documents without any console application. Help needed to create it

marx-yu commented 9 years ago

access_token, generally, is the credential, for accessing the file, such as encode(base64) from username and password

kmkmahesh commented 9 years ago

Thanks for reply

I need a sample script for editing in asp

and I don't saw any thing where I can pass username and password

marx-yu commented 9 years ago

for example: access_token=base64(u=userid;p=password)

kmkmahesh commented 9 years ago

I am trying from months for this but I can't build or get any asps sample for editing

For me I can edit documents using sharepoint but I need to edit without sharepoint in my web application

Can I get any asp sample please

marx-yu commented 9 years ago

you can use this project "marx-yu/WopiHost". what your problem? for asp sample, I am sorry, I have not any help.

kmkmahesh commented 9 years ago

Thanks for reply

on what file in your project i have to edit the code for passing my user credentials.

do i need to pass user credentials like domain\user or just user or do i change the values in cobaltserver.cs in FileSession(filename, m_docsPath + "/" + filename, @"yonggui.yu", @"yuyg", @"yonggui.yu@emacle.com", false) and CobaltSession can you please tell me what is the best way for building asp for this ???

Chixb commented 9 years ago

Now I can view document in the browser.I need to edit without sharepoint in my web application by PHP.I cannot learn C# before.Does the access_token is necessary to create it?

Chixb commented 9 years ago

I just want to install Office web apps server 2013 without any integration like sharepoint, exchange or lync.And i need to edit the office files in browser.

petrsvihlik commented 9 years ago

Access token is something that you provide to WOPI Client (OWA) and WOPI Client uses it to authenticate against WOPI Host. marx-yu/WopiHost is example of such WOPI Host. If you have a look at CobaltServer.cs (lines 64,66) you'll see that it only checks whether the access_token is set in the query string. In real scenario you would probably want to extract user credentials from it, perform authentication and based on requested file perform also authorization check. To use marx-yu/WopiHost in web application just replace IAsyncResult result with HttpContext context and adjust the code accordingly. Then create IHttpHandler and pass the context to CobaltServer. I'm currently working on a generic WOPI host that will be compatible with web apps as well as windows apps. It'll be on GitHub in few weeks.

marx-yu commented 9 years ago

@petrsvihlik thanks for so detail explain and bright work of WOPI host

kmkmahesh commented 9 years ago

@marx-yu, @petrsvihlik i really cant understand what to edit i dont have much programming skills

can you please tell me what modifications has to be done

  1. how i can create access_token of my own to enter in an url
  2. do i need to make any changes in this code as the petrsvihlik say in cobaltserver.cs 64, 65 lines one of them is empty line

my process until now i can edit all documents using sharepoint

kmkmahesh commented 9 years ago

@marx-yu , @petrsvihlik

i edited code in cobaltserver.cs i edited cobaltserver.cs var fileExt = filename.Substring(filename.LastIndexOf('.') + 1); if (fileExt.ToLower().Equals(@"xlsx")) editSession = new FileSession(filename, m_docsPath + "/" + filename, @"administrator", @"admin", @"administrator@mydomain.tk", false); else editSession = new CobaltSession(filename, m_docsPath + "/" + filename, @"administrator", @"admin", @"administrator@mydomain.tk", false); CobaltSessionManager.Instance.AddSession(editSession);

and uploaded the files in https://defuse.ca/checksums.htm to create sha256

http://wopi.mydomain.tk/we/wordeditorframe.aspx?WOPISrc=http%3a%2f%2flocalhost%3a8080%2fwopi%2ffiles%2fTest.docx&access_token=45406b1543d8762192ae1a6a5a8de6d878af48939eb1343849f5ddc5785ef0ee&ui=en-US

http://wopi.mydomain.tk/x/_layouts/xlviewerinternal.aspx?WOPISrc=http%3a%2f%2flocalhost%3a8080%2fwopi%2ffiles%2fTest.xlsx&access_token=2702ac89018e16436f8830ba58fad13bb68485be7b79ab5a2ddb86a696f547f5&ui=en-US

but i am getting error on both

petrsvihlik commented 9 years ago

what error are you getting? have you tried to debug the CobaltServer? does the request even reach the code? i see you are passing some kind of token - that should be enough for WopiHost as it only checks whether it's set or not. so the problem will be elsewhere

kmkmahesh commented 9 years ago

@petrsvihlik can i message you in twitter ???

petrsvihlik commented 9 years ago

hi, i'd prefer github or stackoverflow as those are the right places to discuss dev topics.

kmkmahesh commented 9 years ago

@petrsvihlik ok but i want to show everything by giving remote desktop of mine

petrsvihlik commented 9 years ago

@kmkmahesh maybe later in the evening (i'm gmt+1). i also have work to be done :D

kmkmahesh commented 9 years ago

ok when ever you are free i am ready i just emailed to your organization email