Hi,
This guide (https://developer.genesys.cloud/commdigital/digital/webmessaging/messengersdk/authenticatedMessenger) tells to use the AuthProvider.registerCommand('getAuthCode' ... function to accomplish the step 6 of the image under "Authenticated web message flow" at link https://developer.genesys.cloud/commdigital/digital/webmessaging/authenticate#authenticated-web-message-flow
The problem I am facing is that my auth server (auth0) needs additional parameters, other than:
authCode: , // pass your authorization code here
redirectUri: , // pass the redirection URI configured in your Authentication provider here
nonce: , // pass the random string preferably in uuid format. Applicable for OKTA provider.
maxAge: , // pass elapsed time in seconds. Applicable for OKTA provider and it is an optional parameter.
codeVerifier: // pass your code verifier here when PKCE flow is enabled
iss: , // pass your iss here. It is an optional parameter provided in the authorization response by your Authentication provider.
I need to add user_id and user_name fields,
See here one Sucess Authorization Code for Access Token generated with my auth server:
{
"date": "2022-11-29T22:03:06.975Z",
"type": "seacft",
"description": "Authorization Code for Access Token",
"connection_id": "",
"client_id": "JKZ6L20wpOI4qWX2kswEahAoytXPErsD",
"client_name": "My App",
"ip": "177.86.98.167",
"user_agent": "Other 0.0.0 / Other 0.0.0",
"details": {
"code": "******************************************OnG"
},
"hostname": "dev-qddc8snapx3463gm.us.auth0.com",
"user_id": "auth0|6384d1eece5082a502e060e6",
"user_name": "lukaarruda@hotmail.com",
"auth0_client": {
"name": "express-oidc",
"version": "2.10.0",
"env": {
"node": "v16.14.1"
}
},
"log_id": "90020221129220311992170765555527241006091813296172695570",
"_id": "90020221129220311992170765555527241006091813296172695570",
"isMobile": false,
"id": "90020221129220311992170765555527241006091813296172695570"
}
See here the failed attempt made from Genesys plugin (AuthProvider.registerCommand('getAuthCode' ...):
{
"date": "2022-11-29T22:03:29.333Z",
"type": "feacft",
"description": "Invalid authorization code",
"connection_id": "",
"client_id": "JKZ6L20wpOI4qWX2kswEahAoytXPErsD",
"client_name": "My App",
"ip": "52.40.250.127",
"user_agent": "Other 0.0.0 / Other 0.0.0",
"details": {
"code": "******************************************OnG"
},
"hostname": "dev-qddc8snapx3463gm.us.auth0.com",
"user_id": "",
"user_name": "",
"log_id": "90020221129220333234030845274560395248984397663426314242",
"_id": "90020221129220333234030845274560395248984397663426314242",
"isMobile": true,
"id": "90020221129220333234030845274560395248984397663426314242"
}
I tried adding those custom parameters in the server code:
// COMMAND
// *********
// getAuthCode
// reAuthenticate
/* Register Command - mandatory */
AuthProvider.registerCommand('getAuthCode', (e) => {
// Add the necessary logic and resolve with the authCode and redirectUri provided by your Authentication provider. Messenger will call this command to get the the tokens.
e.resolve({
authCode: authCode,
redirectUri: 'https://lucasarruda.ml:3000/profile',
user_id: "auth0|6384d1eece5082a502e060e6",
user_name: "lukaarruda@hotmail.com"
});
});
But what I see it that those additional ones are not sent to Genesys Platform, see here what I can see on user browser network log being sent:
Request URL: https://api.usw2.pure.cloud/api/v2/webdeployments/token/oauthcodegrantjwtexchange
Payload:
{"deploymentId":"29015b77-2699-4a95-8d8a-33cadd6919de","oauth":{"code":"KQZlhQs8nAqEyDtD24LfuvFCO00pAWF0pYswddCnbjOnG","redirectUri":"https://lucasarruda.ml:3000/profile"},"journeyContext":{"customer":{"id":"31342340-537e-450b-8b16-995938c34e04","idType":"cookie"},"customerSession":{"id":"f9cb4b45-27e8-433f-ac21-7690d24c8fd7","type":"web"}}}
Please advise if is possible to add those two custom fields (user_id, user_name) on this step 6 (see 2nd link sent on this case description, here again for easy reference: https://developer.genesys.cloud/commdigital/digital/webmessaging/authenticate#authenticated-web-message-flow)