Page 1 of 6

Dropbox Livecode Library

Posted: Wed Aug 01, 2012 1:42 pm
by gpb01
Dear all,
I am pleased to announce the release of a simple Livecode library to access Dropbox from any platform Livecode support.

The library uses the Dropbox REST API, so only HTTPS GET and PUT (PUSH on mobile because there is not HTTPS PUT).

Since the community of Livecode developers is quite small, I thought it would be better to freely openly share the library so, I thought the MIT license. After all ...
... collaboration with other developers is better than a couple of bucks ! ;)

You can download the library, the release notes and a simple test program from the following link :

http://www.phoenixsea.ch/downloads/Live ... boxLib.zip

I hope that is useful for you.

Best regards,

Guglielmo

P.S. : I want to thank for the support received during the development : Andre Garzia, Franz Moser and Monte Goulding :)

Re: Dropbox Livecode Library

Posted: Thu Aug 02, 2012 11:35 am
by jr180180
Very nice. Thanks!

Re: Dropbox Livecode Library

Posted: Fri Aug 31, 2012 5:57 pm
by andyh1234
Nice work Guglielmo, ive only just got a chance to run this properly but it is excellent!

Thanks for sharing it with the community.

Andy

Re: Dropbox Livecode Library

Posted: Mon Mar 17, 2014 3:19 pm
by Sjatplat
Ah. Great. Thank you.

Re: Dropbox Livecode Library

Posted: Fri Feb 13, 2015 8:59 am
by sphere
Great !

I was looking for something like this. I hope i can use it :)

I allready was looking at Phonagaps because there was support for it, but again then you have to learn something new again, and i'm just getting to get familiar with Livecode, maybe we can call it Lovecode because it's so fantastic!

Re: Dropbox Livecode Library

Posted: Fri Feb 13, 2015 10:35 am
by sphere
Great! the test works very good.
Now i can rewrite my 2 proggies.

Just simple: 1 write with windows a text file to dropbox
2 read it out on android phone and display the txt

Thanks for sharing this solution!

Re: Dropbox Livecode Library

Posted: Tue Feb 17, 2015 12:05 pm
by sphere
Hello,

anyone managed to log-in and authorize automatically?

I tried some but it don't work.

An error is popping up.

With the test stack it works but you get an browser windows with login ability and after that you have to authorize it.
But i want it to happen without the user seeing it. Just startup the program and after a few seconds your in.
I'm creating a displaying app. which only displays a few lines of text, with no further interaction of the user.

Thanks for any help on this automatically login.

Sphere

Re: Dropbox Livecode Library

Posted: Tue Feb 17, 2015 2:37 pm
by Mikey
Are you referring to using a user's own dropbox account, or using your account? Once the app is authorized for an account, you retrieve the tokens and then it's automagic. It's that very first time that you have to deal with logging in, before you'll be given the tokens.

Re: Dropbox Livecode Library

Posted: Tue Feb 17, 2015 8:04 pm
by sphere
Hi Mikey,

well i created an app in dropbox (permission type = app folder) and have an app key and a secret key.
I can fill these in in the test program to see it works, but then it asks for my log-in and after that it asks for persmission to enter the folder.

Maybe i have choosen a wrong type of app in dropbox?

I can generate an access token, but it does not stay on the dropbox page?

Ok i admit, i really understand it only partly.

Thanks for your help!


---edit--- i changed the Authorize button a bit so got to see the tokens when its authorized.
So i hope i can continue from there, so no separate login is no longer neccesary . I have to read some more in the word document which is in the above zip.

okidoki now i get it, the tokens i now have, have to be filled in on this line too(along with the api keys): phx_DropboxInitLib pAppKey, pAppSec, pTokKey, pTokSec and then the application should have directly access to the folder with the files, correct?

Thanks!

Re: Dropbox Livecode Library

Posted: Tue Feb 17, 2015 8:57 pm
by Mikey
Dropbox thinks of an app as being something generic enough that any user can run it with their personal dropbox account.

So, when you "create" your app in Dropbox, it first gives you an app key and app secret, for use with your app. Next Steps:
  • get phx_dropboxInitLib(appkey,appsecret)
  • it should be empty.
  • get phx_dropboxReqToken()
  • it will have the URL to open in the LC Browser or in whatever browser you want the user to use, so that they can authorize your app to use their Dropbox account. I would just use the LC browser, so you can control the experience, and know when they're done with the process.
  • Once they have authorized the app to have access to their dropbox account, get phx_dropboxAuthorized()
  • it will have three lines in it. The first line is the token key, the second is the token secret. The third line can be ignored.
Now, and from here on, for that user, you can just call get phx_dropboxInitLib (appKey, appSecret, tokenKey, tokenSecret)

By doing things this way, your app does not have to know the user's username or password, and if they change one or the other, it won't affect you at all, because your token key and token secret are in effect your app's username and password for that user's account.

Also note that typically your app will be sandboxed in a folder (with your app's name) inside of their dropbox account, so you won't have access to their other dropbox data, similar to the way sandboxing works in ios.

Re: Dropbox Livecode Library

Posted: Tue Feb 17, 2015 10:07 pm
by sphere
Thanks a lot for your explanation Mikey.

All devices will be used in one workshop just to indicate what project is on the workbench. So in fact there is one user.
On a windows machine the text lines will be send to the txt files on dropbox and then read out and displayed on the android pads. at least that's the plan :)

So now i can test piece by piece of code if things will work like planned.

Thanks and i will let you know if progression goes ok or not, but i have good hopes :mrgreen:

Re: Dropbox Livecode Library

Posted: Tue Feb 17, 2015 11:24 pm
by Mikey
The only other thing that you can run into is dealing with filenames that contain characters that need to be escaped, and uploading/downloading files with characters that need to be escaped. There is a long discussion of those topics on the use list.

Re: Dropbox Livecode Library

Posted: Wed Feb 18, 2015 5:27 pm
by sphere
Thanks for letting me know.
I've run a test and it works perfect! on windows.

I also tested the Android test piece, and it seems to connect, but not yet reading the txt file.
A txt file just contains 1 short string, so no difficulties to expect here :)

Have to test some more 8)

Great! also the android part is working! just did some very small tests, connecting, read txt file OK!

Re: Dropbox Livecode Library

Posted: Sat Apr 25, 2015 6:19 pm
by sphere
Hello, i noticed a new problem.

When saving as a standalone for windows with LC7.04 it does NOT make a connection with dropbox.
(i just tested under windows as i noticed it won't connect)

When doing this with LC7.03 is does work as expected.

Is this a fail from LC7.04 or something with the library being not compatible with LC7.04 ?

Just to make sure before create a bug report.

Anyone else can confirm?

NOTE: that it does work in LC7.04 when working in the editor, just NOT when saved as standalone.

Thanks for any help.

Re: Dropbox Livecode Library

Posted: Sat Apr 25, 2015 6:41 pm
by FourthWorld
Where/how does it fail in v7.0.4?