Sign In Dropbox using oAuth 2
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Site Admin
- Posts: 343
- Joined: Thu Feb 23, 2006 7:59 pm
- Location: Wales
Sign In Dropbox using oAuth 2
I'm posting this on behalf of wimpykid1570, who is a new member and hence unable as yet to post urls.
Hi,
I tried to sign in my dropbox account using oAuth 2 from a desktop app on Windows 8.1.
1. I don't have IIS installed so I don't have a localhost and I don't want to use an external link for redirect_uri. What should I put in for redirect_uri which is a required field? Can I use a variable or a local file path so that I can retrieve my access code?
2. I tried to detect when dropbox redirect to my redirect_uri (which now I use a fake one) so that I can look at the response header, but the browserBeforeNavigate does not get triggered.
Thanks in advance for any ideas or suggestions.
on mouseUp
put "xxxxxxx" into tAppKey
put base64Encode(randomBytes(16)) into tCSRFToken
put "https://www.dropbox.com/1/oauth2/authorize?" & \
"response_type=token&" & \
"state=" & tCSRFToken & "&" & \
"client_id=" & tAppKey & "&" & \
"redirect_uri=SOME_THING" \
into tRequest
put revBrowserOpen((the windowId of this stack), tRequest) into tBrowserId
revBrowserSet tBrowserId, "showborder", "true"
revBrowserSet tBrowserId, "rect", the rectangle of image "MyImage"
end mouseUp
on browserBeforeNavigate bBrowserId, pURL
if "dropbox.com" is not in pURL then
put true into browserCancel
end if
end browserBeforeNavigate
Toan
Hi,
I tried to sign in my dropbox account using oAuth 2 from a desktop app on Windows 8.1.
1. I don't have IIS installed so I don't have a localhost and I don't want to use an external link for redirect_uri. What should I put in for redirect_uri which is a required field? Can I use a variable or a local file path so that I can retrieve my access code?
2. I tried to detect when dropbox redirect to my redirect_uri (which now I use a fake one) so that I can look at the response header, but the browserBeforeNavigate does not get triggered.
Thanks in advance for any ideas or suggestions.
on mouseUp
put "xxxxxxx" into tAppKey
put base64Encode(randomBytes(16)) into tCSRFToken
put "https://www.dropbox.com/1/oauth2/authorize?" & \
"response_type=token&" & \
"state=" & tCSRFToken & "&" & \
"client_id=" & tAppKey & "&" & \
"redirect_uri=SOME_THING" \
into tRequest
put revBrowserOpen((the windowId of this stack), tRequest) into tBrowserId
revBrowserSet tBrowserId, "showborder", "true"
revBrowserSet tBrowserId, "rect", the rectangle of image "MyImage"
end mouseUp
on browserBeforeNavigate bBrowserId, pURL
if "dropbox.com" is not in pURL then
put true into browserCancel
end if
end browserBeforeNavigate
Toan
-
- Posts: 10
- Joined: Thu May 01, 2014 2:31 pm
Re: Sign In Dropbox using oAuth 2
Anyone can help me on this? Thanks.
-
- Posts: 10
- Joined: Thu May 01, 2014 2:31 pm
Re: Sign In Dropbox using oAuth 2
Anyone can help me on this? Any moderators? Thanks.
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Sign In Dropbox using oAuth 2
Hi wimpykid1570,
I don't know if this thread is of any use to you but check it out:
http://forums.runrev.com/phpBB2/viewtop ... =4&t=12549
Guglielmo's great stack.
Simon
I don't know if this thread is of any use to you but check it out:
http://forums.runrev.com/phpBB2/viewtop ... =4&t=12549
Guglielmo's great stack.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- VIP Livecode Opensource Backer
- Posts: 858
- Joined: Wed Jun 24, 2009 1:17 pm
- Location: Plymouth, UK
- Contact:
Re: Sign In Dropbox using oAuth 2
Hi wimpykid1570
As Simon says, check out Guglielmo's library - I use it a lot and it works brilliantly
Kind regards
Dave
As Simon says, check out Guglielmo's library - I use it a lot and it works brilliantly
Kind regards
Dave
"...this is not the code you are looking for..."
-
- Posts: 10
- Joined: Thu May 01, 2014 2:31 pm
Re: Sign In Dropbox using oAuth 2
Thanks for the quick responses.
I already checked that stack a while ago. It uses oAuth 1.0, not oAuth 2.0. I need to implement something like that in oAuth 2.0.
Anyone has some livecode samples that use oAuth 2.0?
Thanks again,
Toan
I already checked that stack a while ago. It uses oAuth 1.0, not oAuth 2.0. I need to implement something like that in oAuth 2.0.
Anyone has some livecode samples that use oAuth 2.0?
Thanks again,
Toan
-
- VIP Livecode Opensource Backer
- Posts: 858
- Joined: Wed Jun 24, 2009 1:17 pm
- Location: Plymouth, UK
- Contact:
Re: Sign In Dropbox using oAuth 2
Hi Toan
Ah, didn't clock the oAuth 2.0 part of what you needed ... I suspect Monte's external is also oAuth 1.0 but his work is definitely worth checking out: http://mergext.com/home/mergdropbox/
Dave
Ah, didn't clock the oAuth 2.0 part of what you needed ... I suspect Monte's external is also oAuth 1.0 but his work is definitely worth checking out: http://mergext.com/home/mergdropbox/
Dave
"...this is not the code you are looking for..."
-
- Posts: 10
- Joined: Thu May 01, 2014 2:31 pm
Re: Sign In Dropbox using oAuth 2
Thanks Dave,
Actually, I am not that concerned about oAuth 2 since I know how to do that part ouside of LiveCode. I can do that in ASP.NET or cUrl.
I just want to know how to solve #2. Why doesnt' browserBeforeNavigate work? It does not detect an URL change after I signed in Dropbox. If you or anyone can make that part works or explain me why it would not work, I appreciate the help.
Thanks.
Toan
Actually, I am not that concerned about oAuth 2 since I know how to do that part ouside of LiveCode. I can do that in ASP.NET or cUrl.
I just want to know how to solve #2. Why doesnt' browserBeforeNavigate work? It does not detect an URL change after I signed in Dropbox. If you or anyone can make that part works or explain me why it would not work, I appreciate the help.
Thanks.
Toan
Re: Sign In Dropbox using oAuth 2
Hi Toan,
sorrry, no idea about this stuff, but two observations:
1. you you did not define tBrowserID as a local or global variable!
2. In your script you use tBrowserID
...
put revBrowserOpen((the windowId of this stack), tRequest) into tBrowserId
...
And then later bBrowserID
...
on browserBeforeNavigate bBrowserId, pURL
...
Best
Klaus
sorrry, no idea about this stuff, but two observations:
1. you you did not define tBrowserID as a local or global variable!
2. In your script you use tBrowserID
...
put revBrowserOpen((the windowId of this stack), tRequest) into tBrowserId
...
And then later bBrowserID
...
on browserBeforeNavigate bBrowserId, pURL
...
Best
Klaus
-
- Posts: 10
- Joined: Thu May 01, 2014 2:31 pm
Re: Sign In Dropbox using oAuth 2
Thanks for the suggestion.
But now it drills down to the browser itself not working consistently. I just posted a new topic for that matter at http://forums.livecode.com/viewtopic.php?f=8&t=20762.
But now it drills down to the browser itself not working consistently. I just posted a new topic for that matter at http://forums.livecode.com/viewtopic.php?f=8&t=20762.