OAuth2 on Win10: not returning to my app

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

OAuth2 on Win10: not returning to my app

Ralph DiMola via use-livecode
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
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: OAuth2 on Win10: not returning to my app

Ralph DiMola via use-livecode
It does sound like an issue with the redirect uri.

Perhaps a configuration issue in your app on the endpoint? Some endpoints will use the redirect uri from the request, some will ensure it matches perfectly with your settings for your app on their portal, some will just use the redirect in the portal settings.

Whatever is happening, there is no HTTP request to localhost on your specified port because if there was the dialog would close by itself.

> On 30 Jun 2020, at 6:14 am, Richard Gaskin via use-livecode <[hidden email]> wrote:
>
> 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
> ____________________________________________________________________
> [hidden email]                http://www.FourthWorld.com
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: OAuth2 on Win10: not returning to my app

Ralph DiMola via use-livecode
May be related but I’m having an issue with an old script returning cancel with oauth2 lib today - can’t debug will check in morning
On 30 Jun 2020, 23:19 +0100, Monte Goulding via use-livecode <[hidden email]>, wrote:

> It does sound like an issue with the redirect uri.
>
> Perhaps a configuration issue in your app on the endpoint? Some endpoints will use the redirect uri from the request, some will ensure it matches perfectly with your settings for your app on their portal, some will just use the redirect in the portal settings.
>
> Whatever is happening, there is no HTTP request to localhost on your specified port because if there was the dialog would close by itself.
>
> > On 30 Jun 2020, at 6:14 am, Richard Gaskin via use-livecode <[hidden email]> wrote:
> >
> > 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
> > ____________________________________________________________________
> > [hidden email] http://www.FourthWorld.com
> >
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: OAuth2 on Win10: not returning to my app

Ralph DiMola via use-livecode
In reply to this post by Ralph DiMola via use-livecode
Thanks for confirming my hunch about the redirect URI.

I've passed along a localhost string to the Azure admin with a port
specifier that matches the one I'm passing into the lib.  Still no go -
same result, no browser widget close.

One possible issue: the admin tells me the Azure admin UI doesn't allow
"http" as a scheme, so he used "https".  Azure accepted it so that much
is fine, but of course SSL isn't used for local host so is that what's
throwing this off?

Any guidance would be greatly appreciated, even if it's just to docs for
the lib.  So far all I've found it one example Lesson about Slack.

TIA -

--
  Richard Gaskin
  Fourth World Systems


Monte Goulding wrote:

 > It does sound like an issue with the redirect uri.
 >
 > Perhaps a configuration issue in your app on the endpoint? Some
 > endpoints will use the redirect uri from the request, some will ensure
 > it matches perfectly with your settings for your app on their portal,
 > some will just use the redirect in the portal settings.
 >
 > Whatever is happening, there is no HTTP request to localhost on your
 > specified port because if there was the dialog would close by itself.
 >
 >> On 30 Jun 2020, at 6:14 am, Richard Gaskin wrote:
 >>
 >> 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 -
 >>
 >> --



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: OAuth2 on Win10: not returning to my app

Ralph DiMola via use-livecode
In reply to this post by Ralph DiMola via use-livecode
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 <[hidden email]>:
>
> 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
> ____________________________________________________________________
> [hidden email]                http://www.FourthWorld.com
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode