jwagner79 / DropboxZimlet

A Zimlet for Dropbox integration. Provides the ability to save an attachment in Zimbra to Dropbox and attach a link to a Dropbox file when composing a message.
7 stars 7 forks source link

Attach from dropbox gives Invalid app_key #2

Closed MichaKersloot closed 11 years ago

MichaKersloot commented 11 years ago

Trying to attach a file from dropbox gives {"error": "Invalid app_key"} and the URL info shows app_key=null:

https://www.dropbox.com/chooser?origin=https%3A%2F%2Fcontact.kovoks.nl&app_key=null&link_type=preview&trigger=js

jwagner79 commented 11 years ago

Did you set the ChooserAppKey to a value? You should use developers.dropbox.com to get a appkey value for Chooser.

MichaKersloot commented 11 years ago

I've quadruple checked it and I've got 2 keys:

App nameType Status
KovoKs Contact ChooserDropbox ChooserEnabled
KovoKs Contact SaveApp folderDevelopment

And /opt/zimbra/zimlets-deployed/com_zimbra_dropbox/config_template.xml contains: <zimletConfig name="com_zimbra_dropbox" version="1.0"> <global> <property name="ChooserAppKey">80xxxxxxxxxxx3</property> <property name="ZimbraAppKey">fdxxxxxxxxxxxfu</property> <property name="ZimbraAppSecret">3oxxxxxxxxxxxmb</property>
</global> </zimletConfig>

MichaKersloot commented 11 years ago

I may completely be wrong, but if I searched the code for the appKey I've found in the top of dropbox.js (line 5):

if ((el = document.getElementById('dropboxjs')) !== null) {

And i'm unable to find any element in the dom with dropboxjs when running with firebug enabled. This probably shows that I'm a terrible programmer, but hey... Maybe it could help to solve the problem.

jwagner79 commented 11 years ago

@MichaKersloot You are still getting the same error? Can you put a breakpoint here: DropboxZimlet.prototype.showDropboxChooser (run with ?dev=1). What is the value of appKey when you get its passed to Dropbox.init in the options object?

MichaKersloot commented 11 years ago

I'm afraid I still have the problem. I'm already busted having not much experience in debugging Javascript / Zimbra code. How do I set ?dev=1, adding it to the zimbra url doesn't seem to work as the url gets cleaned after login or reload. I was able to set a breakpoint on DropboxZimlet.prototype.showDropboxChooser, but then I was unable to find Dropbox.init where should I start looking? The Dropbox->init seems to have an enless recursive list in proto, prototyp and run elements. I've you are willing to help further, We do have a test account on the server on which I just enabled the dropbox zimlet.

Although learning how to debug these scripts is not bad either.

jwagner79 commented 11 years ago

@MichaKersloot To run Zimbra web client in debug mode you just enter append ?dev=1 to the url. So, https://mail.domain.com/ you enter https://mail.domain.com?dev=1

You can send the me the account server/credentials and I'll have a look. Just email them to jwagner at gmail dot com.

MichaKersloot commented 11 years ago

Hi,

I've switched to the Chrome developer console and was able to follow the actions in the zimlet. Then I saw the ChooserApp key twice in some config object. That started me thinking that my edited config_template.xml was never used by Zimbra. So I've done a little digging and it seems that you have to redeploy the zimlet to activate any changes (except when you are using the _dev folder on the server. Two options now ;-) Add configuration options for the keys so you can edit them in Zimbra(Admin), or add the following to your documentation:

To install this zimlet, you have to configure it first. When you have your keys, unzip the file in an empty folder, then add your keys to the config_template.xml file and rezip all te files to a new zip com_zimbra_dropbox.zip Use this new zip to deploy the zimlet on your server.

jwagner79 commented 11 years ago

@MichaKersloot Great! It sounds like it's working now. Redeploying the Zimlet after making the changes is standard Zimlet practice. If you think the instructions could be improved to help others please send a pull request and I can incorporate.

canbaran14 commented 7 years ago

Hello, I read your comments and It is very useful thanks for everything but I've got two questions about it. First one; My zimbra server doesn't have real domain I mean It can't receive mail from gmail or somewhere else except other domain on zimbra server. Must I have real domain for integration Dropbox with Zimbra? Second one: How can I find chooser Appkey ? Please help me, I'm working on it whole day :/