# How to open websocket with authorization token

**URL:** <https://discuss.elastic.co/t/how-to-open-websocket-with-authorization-token/59769>\
**Category:** Logstash\
**Created:** [September 4, 2016, 9:58pm UTC](https://discuss.elastic.co/t/how-to-open-websocket-with-authorization-token/59769 "2016-09-04T21:58:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![spuder](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spuder/32/44895_2.png) [@spuder](https://discuss.elastic.co/u/spuder)\
**Post date:** [September 4, 2016, 9:58pm UTC](https://discuss.elastic.co/t/how-to-open-websocket-with-authorization-token/59769/1 "2016-09-04T21:58:09Z")

</div>

I'm trying to get logstash to listen to a websocket that requires authentication.

WebSocket documentation  
[http://seeed-studio.github.io/Wio\_Link/#node-event-api-use-websocket](http://seeed-studio.github.io/Wio_Link/#node-event-api-use-websocket)

Javascript example

```
var ws = new WebSocket('wss://iot.seeed.cc/v1/node/event');
ws.onopen = function() {
    ws.send("d6d68b4b6b43f213569f5832dd8277b2");
};
ws.onmessage = function (evt) {
    alert(evt.data);
};

```

Here is the same example using the chrome websocket extension

 ![](https://us1.discourse-cdn.com/elastic/original/2X/3/3e1cc7c1c88e605cecda5d37ef4445626378ea55.png)

Can logstash pass authroization tokens to web sockets? Looking at the logstash websocket plugin documentation and also the[ruby-ftw ruby gem logstash](https://github.com/jordansissel/ruby-ftw/blob/master/examples/websocket.rb) is based on, I don't see any documented way to do this.

I've tried passing the token in as part of the url header, with no luck. e.g.

> 'wss://us.wio.seeed.io/v1/node/event?access\_token=c3ed51cc8cb2a55351c576159ab37517/'

```
input {
  websocket {
    mode => client
    url => 'wss://us.wio.seeed.io/v1/node/event?access_token=c3ed51cc8cb2a55351c576159ab37517/'
  }
}
output {
  stdout{
    codec => rubydebug
  }
}

```

---

<div class="post-metadata">

**Author:** ![raghav\_subramanian](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@raghav\_subramanian](https://discuss.elastic.co/u/raghav_subramanian)\
**Post date:** [October 25, 2016, 9:06am UTC](https://discuss.elastic.co/t/how-to-open-websocket-with-authorization-token/59769/2 "2016-10-25T09:06:02Z")

</div>

Did you solve the issue?  
I guess you might have to try putting some other param name instead of 'access\_token'  
something like 'token'?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:32am UTC](https://discuss.elastic.co/t/how-to-open-websocket-with-authorization-token/59769/3 "2017-07-06T04:32:54Z")

</div>


