OAuth2Refresh - unknown field "redirect_uri"

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
JereMiami
Posts: 120
Joined: Mon Nov 03, 2014 12:17 am

OAuth2Refresh - unknown field "redirect_uri"

Post by JereMiami » Fri Dec 02, 2022 6:06 pm

I had success with the OAuth2 command for Dropbox in obtaining a short lived token. But the API does not like the "redirect_uri" parameter coded into the OAuth2Refresh command. According to the Dropbox documents pertaining the refresh tokens, Dropbox does not ask for this parameter when issuing a refresh token and hence, the above error.

Is there any workaround for this? The cURL is:

Code: Select all

curl https://api.dropbox.com/oauth2/token \     -d grant_type=refresh_token \     -d refresh_token=<REFRESH_TOKEN> \     -u <APP_KEY>:<APP_SECRET>
Any suggestions on how I can post the data to the url so that I can get that refresh token?

JereMiami
Posts: 120
Joined: Mon Nov 03, 2014 12:17 am

Re: OAuth2Refresh - unknown field "redirect_uri"

Post by JereMiami » Fri Dec 02, 2022 6:43 pm

Nevermind - Here is the work-a-roud.

Code: Select all

on mouseUp
   put "XXXXX" into tAppKey
   put "YYYYY" into tAppSecret
   put "Authorization: Basic" && base64Encode(tAppKey & ":" & tAppSecret) into tHeaders
   set the httpHeaders to tHeaders 
   put "https://api.dropbox.com/oauth2/token" into tUrl
   post "grant_type=refresh_token&refresh_token=ZZZZZ" to tUrl
   put it into tResponse
end mouseUp

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”