Dropbox Livecode Library

Find out what's going on with LiveCode (the company), product releases, announcements, and events.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm
Location: Switzerland

Dropbox Livecode Library

Post by gpb01 » Wed Aug 01, 2012 1:42 pm

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 :)

jr180180
Posts: 12
Joined: Fri Apr 20, 2012 8:59 am

Re: Dropbox Livecode Library

Post by jr180180 » Thu Aug 02, 2012 11:35 am

Very nice. Thanks!

andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Re: Dropbox Livecode Library

Post by andyh1234 » Fri Aug 31, 2012 5:57 pm

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

Sjatplat
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 75
Joined: Wed Jun 22, 2011 1:53 pm
Location: Norway

Re: Dropbox Livecode Library

Post by Sjatplat » Mon Mar 17, 2014 3:19 pm

Ah. Great. Thank you.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Dropbox Livecode Library

Post by sphere » Fri Feb 13, 2015 8:59 am

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!

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Dropbox Livecode Library

Post by sphere » Fri Feb 13, 2015 10:35 am

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!

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Dropbox Livecode Library

Post by sphere » Tue Feb 17, 2015 12:05 pm

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

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Dropbox Livecode Library

Post by Mikey » Tue Feb 17, 2015 2:37 pm

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.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Dropbox Livecode Library

Post by sphere » Tue Feb 17, 2015 8:04 pm

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!

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Dropbox Livecode Library

Post by Mikey » Tue Feb 17, 2015 8:57 pm

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.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Dropbox Livecode Library

Post by sphere » Tue Feb 17, 2015 10:07 pm

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:

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Dropbox Livecode Library

Post by Mikey » Tue Feb 17, 2015 11:24 pm

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.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Dropbox Livecode Library

Post by sphere » Wed Feb 18, 2015 5:27 pm

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!

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Dropbox Livecode Library

Post by sphere » Sat Apr 25, 2015 6:19 pm

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.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Dropbox Livecode Library

Post by FourthWorld » Sat Apr 25, 2015 6:41 pm

Where/how does it fail in v7.0.4?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Announcements”