OAuth: I am not receiving the any `code` in the authorization request

I am writing a plugin which will use OAuth to authenticate users, however, OpenAI is not sending the code in the request parameters or body.

I haven’t implemented OAuth before, so I may be missing something.
The first call works as expected, and the client is redirected to something like: chat.openai.com/aip/plugin-XXXXXXXX/oauth/callback?code=_some_code_

In the second call, I expect that OpenAI client will send me client id, secret and the _some_code_ which was sent earlier, but I don’t receive any of these. Is my expectation correct?

app.post('/oauth2/token', tokenFunction());

function tokenFunction() {
  return function (req, res) {
    console.log("oauth2/tokenFunction");
    console.log("query:", req.query);
    console.log(req.body);
    console.log(req.params);
    console.log(req.headers)
....
}
1 Like