From 4f337dc6fe1c4d413b7f08c11a5af838bc020678 Mon Sep 17 00:00:00 2001 From: moults31 Date: Sun, 24 Oct 2021 14:24:11 -0500 Subject: [PATCH] Fix #283, move to new auth token format --- .../slack/simpleslackapi/impl/SlackWebSocketSessionImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sources/src/main/java/com/ullink/slack/simpleslackapi/impl/SlackWebSocketSessionImpl.java b/sources/src/main/java/com/ullink/slack/simpleslackapi/impl/SlackWebSocketSessionImpl.java index 47ba5e90..d23f6bf2 100644 --- a/sources/src/main/java/com/ullink/slack/simpleslackapi/impl/SlackWebSocketSessionImpl.java +++ b/sources/src/main/java/com/ullink/slack/simpleslackapi/impl/SlackWebSocketSessionImpl.java @@ -23,6 +23,7 @@ import javax.websocket.WebSocketContainer; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; +import org.apache.http.HttpHeaders; import org.apache.http.NameValuePair; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; @@ -381,7 +382,9 @@ private void connectImpl() throws IOException { LOGGER.info("connecting to slack"); HttpClient httpClient = getHttpClient(); - HttpGet request = new HttpGet(slackApiBase + "rtm.start?token=" + authToken); + HttpPost request = new HttpPost(slackApiBase + "rtm.start"); + request.setHeader(HttpHeaders.CONTENT_TYPE,"application/x-www-form-urlencoded"); + request.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + authToken); HttpResponse response = httpClient.execute(request); LOGGER.debug(response.getStatusLine().toString()); String jsonResponse = consumeToString(response.getEntity().getContent());