OAuth2 on Win10: not returning to my app

Michael Muthmannn mimu at dimu.de
Sun Oct 4 16:46:57 EDT 2020


Hi Richard, 
i had a similar issue with another oauth service (not sure if microsoft based),
the problem was inside the handler OAuth2Refresh, the pRefreshToken was already urlencoded.

I only changed  this line:
put "&refresh_token=" & pRefreshToken after tParams

This solved my problem.

command OAuth2Refresh pTokenURL, pClientID, pClientSecret, pRefreshToken, pPort
  local tParams
  put "grant_type=refresh_token" into tParams
  put "&client_id=" & urlEncode(pClientID) after tParams
  put "&client_secret=" & urlEncode(pClientSecret) after tParams
  put "&refresh_token=" & pRefreshToken after tParams
  put "&redirect_uri=" & urlEncode(kRedirectURL & ":" & pPort & "/") after tParams

  local tResponse
  set the httpHeaders to "Accept: application/json"

  post tParams to pTokenURL
  put JSONToArray(it) into tResponse

  -- reset the refresh token so the user doen't accidentally lose it
  if tResponse["refresh_token"] is empty then
     put pRefreshToken into tResponse["refresh_token"]
  end if

  return tResponse for value
end OAuth2Refresh



> Am 29.06.2020 um 22:14 schrieb Richard Gaskin via use-livecode <use-livecode at lists.runrev.com>:
> 
> I've been working with the Oauth2 lib included with v9 (superhandy, team, thanks!), and I've run into a snag:
> 
> When I call it, the browser widgets opens and goes to the authentication provider (in this case Office 365), and authentication seems to work well.
> 
> However, at that point I'd expect the browser widget's window to close and "it" would contain the approved auth scope info.
> 
> Instead what I'm seeing is the browser widget window remains open, and it redirects into my Office 365 account.  I can close the window manually with the "Cancel" button, but then "it" in my calling script contains "Cancel", no auth info.
> 
> Have any of you successfully used LC's OAuth2 lib to log into MS Office 365 or other MS product that uses OAuth?
> 
> If so, what did you use for the redirect URL?  Or is there something else I should be considering?
> 
> TIA -
> 
> -- 
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> ____________________________________________________________________
> Ambassador at FourthWorld.com                http://www.FourthWorld.com
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list