For a Nodejs backend application(no express) how can I generate or get the necessary authCode to use within the function
client.loginCodeAuthorizationGrant
I have had read through the documentation and tried the following, is there some way to tap into the response to get the necessary authCode
A user's browser (or Web component in .Net/Java/... application) must first connect to the Genesys Cloud Authorization Server. https://login.mypurecloud.com/oauth/authorize?client_id=<my-client-id>&response_type=code&redirect_uri=<http://example.com/oauth/callback>
The user enters his credentials.
Upon successful authentication, the Genesys Cloud Authorization Server will redirect the broswer to the URL you specified as redirect URI in the first step.
This request will contain the authorization code as a query parameter.
Ex: http://example.com/oauth/callback?code=my-authorization-code
The example.com must correspond to your backend server application which will receive this HTTP request.
It can then extract the code from the url and perform a query to get an authorization/bearer token from this authorization code.
If your idea is to leverage the Authorization Code Grant flow, without having a user enter his credentials via the login web page of the Genesys Cloud Authorization Server, then it is not possible.
Regarding the first step of the process, I don't get any window launch looking for my credentials, is the expectation the first step will need to be or has to be initiated via user action on the frontend.
The example would be the following (assuming your backend "speaks" HTTP - i.e. acts as a web server).
A user connects to a page that your server manages.
The server checks if there is a session cookie (something your server would set) to see if it can recognize the user connecting, and if this user already authenticated.
If there is no session cookie (or it is unknown), your server requests the user to authenticate first with Genesys Cloud, redirecting him to the Genesys Cloud Authorization server (the https://login.mypurecloud.ie/oauth/authorize url)
But you could also have the user opens his webclient at the following url directly: https://login.mypurecloud.ie/oauth/authorize?client_id=<my-client-id>&response_type=code&redirect_uri=<http://example.com/oauth/callback>
This is if your server/backend does not manage a session cookie (of your own) and just needs to get the authorization-code when the user is redirected to the Redirect URI after successful authentication/authorization on the Genesys Cloud login url.
It would mean you would trigger an authorization flow every time the user opens this url. It is not optimized. But it would still work.