Hi,
I’m facing the issues while authentication through self managed as I am receiving multiple ‘Set-Cookie’ under response.getHeader(“Set-Cookie”).getValue(). Also in SaaS authentication its giving me NullPointerException as I provide credentialId and credentialSecret from the console.
public void authenticate(ApolloClient client) throws TaskListException {
HttpPost httpPost = new HttpPost(taskListUrl + "/api/login");
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("username", taskListUsername));
params.add(new BasicNameValuePair("password", taskListPassword));
httpPost.setEntity(new UrlEncodedFormEntity(params));
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
String cookie = response.getHeader("Set-Cookie").getValue();
client.getHttpHeaders().clear();
client.getHttpHeaders().add(new HttpHeader("Cookie", cookie));
}
} catch (IOException | ProtocolException e) {
throw new TaskListException(e);
}
}