OAuth2 and Dropbox

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
nicoloose
Posts: 99
Joined: Mon Sep 16, 2013 3:35 pm

OAuth2 and Dropbox

Post by nicoloose » Thu Apr 18, 2019 1:09 pm

I am trying to get the user of my app to allow access to his dropbox. I have taken the code from the Dictionary which should work. When OAuth is called, a stack window pops up with the authorisation from dropbox but quickly disappears again before the user can authorise the app. Here's the code:

Code: Select all

constant kAuthURL = "https://www.dropbox.com/oauth2/authorize"
   constant kTokenURL = "https://api.dropboxapi.com/oauth2/token"
   constant kClientID = "xxxxxx"
   constant kClientSecret = "xxxxxxx"
   constant kScopes = ""
   
   OAuth2 kAuthURL, kTokenURL, kClientID, kClientSecret, kScopes, 80
   
   if the result is not empty then (Result empty)
      answer error "Not authorized!" 
   else
      local tAuth
      put it into tAuth tAuth EMPTY since no user interaction?
   end if
There's obviously more to this example but not many places to find any other working examples. Has anyone managed and if so, please share your solution.

nicoloose
Posts: 99
Joined: Mon Sep 16, 2013 3:35 pm

Re: OAuth2 and Dropbox

Post by nicoloose » Sun Apr 21, 2019 6:49 pm

Anyone at all?

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: OAuth2 and Dropbox

Post by bogs » Sun Apr 21, 2019 7:53 pm

While I don't have an answer to your specific question, I seem to remember oAuth was on the way out. Of course, I could be wrong about that, I don't really do much with dropbox + Lc.
Image

nicoloose
Posts: 99
Joined: Mon Sep 16, 2013 3:35 pm

Re: OAuth2 and Dropbox

Post by nicoloose » Mon Apr 22, 2019 8:50 am

OAuth is out but OAuth2 is the new in or am I mistaken?... There are some great drop box libraries out there but all modelled around V1 of dropbox.

I have a working library but it is missing the vital user pre-requisite authorisation for the app to work with their dropbox.

As I said, there's not a huge amount of information out there so a tad confusing.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: OAuth2 and Dropbox

Post by bogs » Mon Apr 22, 2019 1:38 pm

You may well be right, as I said I don't do much (read that "nothing") in this area :oops:

I noted reading the entry on Max's wiki that if your using Lc9, you need to insert the 'start using' statement, and you didn't mention which version of Lc your using.
in:
Commands, Internet
OAuth2

Present an authorization dialog for any web service that supports OAuth2 . Please note that for a bug on version 9 you should type:

Code: Select all

start using stack "oauth2"
in order to use this stack
If that isn't it (and I am sure it is not :P ) I'll try to keep my eye out for a bit more information on it, if no one else chimes in before that.
Image

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

Re: OAuth2 and Dropbox

Post by Mikey » Mon Apr 22, 2019 2:21 pm

The LC Dropbox commands are based on V2, but you are correct, there is no authorization workflow in the commands.

nicoloose
Posts: 99
Joined: Mon Sep 16, 2013 3:35 pm

Re: OAuth2 and Dropbox

Post by nicoloose » Sat Apr 27, 2019 12:33 pm

I am using ver 9.0.3 of Livecode Indy.

Code: Select all

start using stack "oauth2"
This code causes an error "No such stack".

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”