Hello Yuriy,
Thank you for this answer
I tested this but I doesn't receive the data server side.
I overwrote the submit with that :
```
this.submit = () => {
var spinner = document.getElementById('spinner');
spinner.classList.add("loader");
form = document.getElementById('loginForm');
form.addEventListener("click", function(event){
event.preventDefault()
});
var formData = new FormData(form);
formData.append('loginForm:methodTab:loginVoice2', _voice.data);
for (var data of formData.entries()) {
console.log(data[0]+ ': ' + data[1]);
}
// to send request with the new FormData
var xhr = new XMLHttpRequest();
xhr.addEventListener('load', function(event){
console.log('data sent.');
})
xhr.addEventListener('error', function(event) {
alert('Request failed.');
});
var url = form.action; // cf. point 1 after
xhr.open('POST',url)
xhr.setRequestHeader("Content-Type", "multipart/form-data");// Error without this line, and no data server side with this line so...
xhr.send(formData);
}
```
1 - this value is set in windows.onload with -> form.action = window.location.protocol + '//' + window.location.hostname + "#{request.contextPath}/postlogin.htm"; because i wasn't able to interprete js tempalte in an independant js file.
2 - After submit my python script is well triggered if I manualy set Content-Type in header with JS but both requestParameters and request.getParts() are empty.
In an other hand, if I don't set Content-Type, the request look fine
```
Request URL: https://gluu-scw-docker.pre.whispeak.io/oxauth/postlogin.htm
Request Method: POST
Status Code: 200 OK
Remote Address: 163.172.168.51:443
Referrer Policy: strict-origin-when-cross-origin
________
Connection: keep-alive
Content-Length: 68
Content-Type: text/html;charset=utf-8
Date: Tue, 22 Jun 2021 17:36:36 GMT
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: nginx
Set-Cookie: csfcfc=mxV39C%2BCyo9pe2bNDyXi06N535qVCFw%3D; Path=/oxauth; Secure; HttpOnly
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
_______
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: fr-FR,fr;q=0.9,en-GB;q=0.8,en-US;q=0.7,en;q=0.6
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 28119
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryLpFjXXJ0BrRWcXBa
Cookie: rp_origin_id=https://gluu-scw-docker.pre.whispeak.io/identity/authcode.htm; JSESSIONID=node0q3yq23lrqaknk3545jy0phge57.node0; csfcfc=79dlaBFzp95oTTq5I64vgTkflrrmpZc%3D; org.gluu.i18n.Locale=fr; _hjid=00f29872-3df4-419e-a97d-83ea18971dc6; _ga=GA1.2.335482490.1624289661; _ga_YRRDMQSH1G=GS1.1.1624288511.13.1.1624289943.0; current_sessions=["6cf9fac1-ac27-4284-9412-9130ce5d7866"]; session_id=330947c0-ec66-4443-82b1-1d996b4960d6; session_state=d0204d3817a4aa34852d20faea85c794fe53399985ef2157008f51e34adb9b57.71b3d572-9f1e-43d4-a1f3-eac26d3d406f; opbs=73db82e2-5fb7-4864-98ee-50e40e6417b0
Host: gluu-scw-docker.pre.whispeak.io
Origin: https://gluu-scw-docker.pre.whispeak.io
Pragma: no-cache
Referer: https://gluu-scw-docker.pre.whispeak.io/oxauth/authorize.htm?scope=openid+profile+email+user_name&acr_values=whispeak&response_type=code&redirect_uri=https%3A%2F%2Fgluu-scw-docker.pre.whispeak.io%2Fidentity%2Fauthcode.htm&state=20f3db9a-b3ea-472c-9ff7-23a2e21cb989&nonce=ee4ac051-fd02-4d6f-aaf0-6cfd4810f17b&client_id=1001.8079a888-c602-42ca-aed3-2ca73f2665bf
sec-ch-ua: "Chromium";v="91", " Not;A Brand";v="99"
sec-ch-ua-mobile: ?0
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36
_______
loginForm: loginForm
loginForm:username: theusername
loginForm:methodTab:voiceBase64: GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQRChYECGFOAZwH/////////FUmpZpkq17GDD0JATYCGQ2hyb21lV0GGQ2hyb21lFlSua7+uvdeBAXPFh8aJgY6kPBuDg[...]HF6J4P0viK+B9GTCLNvZ3JgOwfJYBwJ8qQUTdNbmNo+BIAdypuvOQfg++rHwb0SS2PGwv5+H6imKFDFEBew9gorJSNWPpn7FjCFRoBlEc13Cvcqf3wwB2bHWjZC07C3V55ZN8S13LqHFNUCBt1v3jHgLoBKwQYBENOjQJmSLNkDag==
loginForm:methodTab:loginVoice: (binary)
loginForm:methodTab_activeIndex: 0
loginForm:platform: {"description":"Chrome 91.0.4472.114 on Linux 64-bit","layout":"Blink","manufacturer":null,"name":"Chrome","prerelease":null,"product":null,"ua":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36","version":"91.0","os":{"architecture":64,"family":"Linux","version":null},"isMobile":false}
javax.faces.ViewState: stateless
loginForm:methodTab:loginVoice2: (binary)
```
But I have an error with python script :
```
2021-06-22 17:36:24,605 INFO [qtp1422222071-3300] [org.gluu.service.PythonService$PythonLoggerOutputStream] (PythonService.java:243) - Use pwd None
2021-06-22 17:36:24,611 INFO [qtp1422222071-3300] [org.gluu.service.PythonService$PythonLoggerOutputStream] (PythonService.java:243) - None
2021-06-22 17:36:24,612 ERROR [qtp1422222071-3300] [org.gluu.oxauth.service.external.ExternalAuthenticationService] (ExternalAuthenticationService.java:212) - javax.servlet.ServletException: javax.servlet.ServletException: Unsupported Content-Type [null], expected [multipart/form-data]
org.python.core.PyException: javax.servlet.ServletException: javax.servlet.ServletException: Unsupported Content-Type [null], expected [multipart/form-data]
```
And RequestParameter is always empty (None at second logs line)
This logs are refering to this script snipet :
```
def authenticate(self, configurationAttributes, requestParameters, step):
if LOG:
self.__print_method(self.authenticate)
logged_in = False
print "Whispeak. Authenticate for step %d" % step
self.__clearMessage()
print "Use pwd %s" % (self.cache.get("USE_PWD"))
if (step == 1 and not self.cache.get("USE_PWD")):
facesContext = CdiUtil.bean(FacesContext)
context = facesContext.getCurrentInstance().getExternalContext()
request = context.getRequest()
login_voice64 = requestParameters.get("loginForm:methodTab:voiceBase64")
print login_voice64
login_voice = request.getPart("loginForm:methodTab:loginVoice2")
print login_voice
for part in request.getParts():
print part
[...]
```
3 - Also whent the previous part will work I am not sure where to redirect after submit, I was thinking to redirect to "#{authorizeAction.redirectUri}", but I am not sure about the beharviour if authentication fail, or if I need a second auth step etc.