Hi James (see? my spies found out who you really are! )

First: hoReq - sorry, I told you not to trust that code! I just typed it in by hand (while in a customer meeting, forsooth!) to get you started. hoReq should be one of the handles declared at the start of the function. Mea culpa!

On how to use the generated struct packages, in your code (not the package code, which you should leave untouched, as you may want to regenerate it at some point, which would overwrite any changes) you would use use:
Send StructToJsonString of oStructHandler_tEvent (&tYourVarName) (&sYourJsonString)
From your main code to get data in a struct variable (YourVarName) into a string (YourJsonString) for passing in your HTTP call. (This is the old way, pre-19.0, and uses strings, with all the problems associated with them. I have a 19.0 version of RestGen, but it hasn't really been tested enough to release yet.)

The example code I gave you was for 19.0 (which I've been using for this kind of stuff for over six months now). Doing it in 18.* is harder, which is why I suggested using 19.0. With 19.0 you can still use the older RestGen program to generate the structs (which can be a very tedious and error-prone exercise when there are large structs involved), but you don't need to use the code in there unless there are names in the JSON which can't be used exactly as DataFlex struct member names (which is what all the pasOriginalName and pasReplacedNames stuff is about).

Redirect URL: this should point to an essentially empty HTML file on the machine your code is running on (your "server", even if that is your development machine ATM - just use "localhost" for testing). It has to be in the same host as your web app, otherwise the JavaScript side of the OAuth2 component can't read the data in its query string. There is a good case for storing this in the database somewhere and reading it before you make your call (for ease of deployment to a "real" server, when it would need to change to point to that machine.

For a fuller explanation, see my slides about this which I presented at EDUC in Berlin last year: https://docs.google.com/presentation...it?usp=sharing.