Page 1 of 1

OAuth2 and Dropbox

Posted: Thu Apr 18, 2019 1:09 pm
by nicoloose
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.

Re: OAuth2 and Dropbox

Posted: Sun Apr 21, 2019 6:49 pm
by nicoloose
Anyone at all?

Re: OAuth2 and Dropbox

Posted: Sun Apr 21, 2019 7:53 pm
by bogs
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.

Re: OAuth2 and Dropbox

Posted: Mon Apr 22, 2019 8:50 am
by nicoloose
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.

Re: OAuth2 and Dropbox

Posted: Mon Apr 22, 2019 1:38 pm
by bogs
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.

Re: OAuth2 and Dropbox

Posted: Mon Apr 22, 2019 2:21 pm
by Mikey
The LC Dropbox commands are based on V2, but you are correct, there is no authorization workflow in the commands.

Re: OAuth2 and Dropbox

Posted: Sat Apr 27, 2019 12:33 pm
by nicoloose
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".