Forum OpenACS Development: continuing thread after redirect for oauth2
probably I am missing something fundamental. I am trying to implement the getting of an oauth2 token for Office365 authentication.
https://www.example-code.com/tcl/office365_oauth2_access_token.asp has an example, which I was trying to follow. Yet the code always stops executing after an ns_returnredirect $url (which I use to redirect the browser to the microsoft login site), as the connection socket is detached .
Therefore the question would be how to let the browser know to open the office365 page while keeping the script running in the background even if the browser "moved on".
On the other hand, if you have implemented oauth2 access with OpenACS / Naviserver differently I am all ears. I "just" need to get the token (as I can take it from there).
Most of the Microsoft oauth2 services receive a redirect_uri, where the service redirects the user when done. So, if you just want to authorize the user, the simplest thing is to construct a URL with client_id, redirect_uri, ... and provide this link to the user to login via o365. The provided redirect_uri will be used by the identity provided after a successful authentication to redirect the client to the response handler from the redirect_uri including, jwt data can be accessed and an auth code which can be used to get the access token via ns_http... Finally one can login the user via OpenACS API (maybe after creating an account etc.) - if wanted.
The Microsoft documentation is IMHO more helpful than the chilicat example.
I realized the major mistake I made. The chilkat example is for an app running on a computer, hence also the redirect to localhost. Guess the chilkat example send my brain on a goose chase.