# Polygon Stream Authentication Failed

**URL:** <https://forum.alpaca.markets/t/polygon-stream-authentication-failed/1618>\
**Category:** App-Integration\
**Created:** [May 28, 2020, 5:16pm UTC](https://forum.alpaca.markets/t/polygon-stream-authentication-failed/1618 "2020-05-28T17:16:22Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![NetArchitect](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/netarchitect/32/834_2.png) [@NetArchitect](https://forum.alpaca.markets/u/NetArchitect)\
**Post date:** [May 28, 2020, 5:16pm UTC](https://forum.alpaca.markets/t/polygon-stream-authentication-failed/1618/1 "2020-05-28T17:16:22Z")

</div>

I already have a funded account of $100. I generate a new set of secret key. But I still get “authentication failed” when I authenticate to polygon stock cluster stream. Is there something else I need to do?

---

<div class="post-metadata">

**Author:** ![cslim](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/cslim/32/46_2.png) [@cslim](https://forum.alpaca.markets/u/cslim)\
**Post date:** [June 2, 2020, 2:13pm UTC](https://forum.alpaca.markets/t/polygon-stream-authentication-failed/1618/2 "2020-06-02T14:13:00Z")

</div>

how are you coding the authentication process?

---

<div class="post-metadata">

**Author:** ![NetArchitect](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/netarchitect/32/834_2.png) [@NetArchitect](https://forum.alpaca.markets/u/NetArchitect)\
**Post date:** [June 2, 2020, 2:44pm UTC](https://forum.alpaca.markets/t/polygon-stream-authentication-failed/1618/3 "2020-06-02T14:44:15Z")

</div>

Here you go. I also tried connecting to Alpaca Data Stream and even REST API but I still can’t authenticate. It seems like an issue with my account and I called customer support and refer me to the forums. Really frustrating.

> ```
> if (this.clientWebSocket == null)
> {
> this.clientWebSocket = new ClientWebSocket();
> await this.clientWebSocket.ConnectAsync("wss://alpaca.socket.polygon.io/stocks", CancellationToken.None);
> 
> await Send(new AuthenticateRequest
> {
> Action = "auth",
> Params = "{live api key}"
> });
> 
> var response = await Receive<List<AuthenticateResponse>>();
> 
> if (response.Where(_ => _.EventType == "status" && _.Status == "connected").FirstOrDefault() == null)
> throw new Exception(string.Format("Unable to authenticate: {0}", response[0].Message));
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![cslim](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/cslim/32/46_2.png) [@cslim](https://forum.alpaca.markets/u/cslim)\
**Post date:** [June 2, 2020, 4:01pm UTC](https://forum.alpaca.markets/t/polygon-stream-authentication-failed/1618/4 "2020-06-02T16:01:12Z")

</div>

dang, I wish I could help. I’m doing most of my stuff in Python. I find it a bit easier.

perhaps this will help?

> **[alpacahq/alpaca-trade-api-csharp](https://github.com/alpacahq/alpaca-trade-api-csharp/)**
>
> C# SDK for Alpaca Trade API https://docs.alpaca.markets/ - alpacahq/alpaca-trade-api-csharp

---

<div class="post-metadata">

**Author:** ![NetArchitect](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/netarchitect/32/834_2.png) [@NetArchitect](https://forum.alpaca.markets/u/NetArchitect)\
**Post date:** [June 2, 2020, 4:49pm UTC](https://forum.alpaca.markets/t/polygon-stream-authentication-failed/1618/5 "2020-06-02T16:49:02Z")

</div>

Thank you. But Im also getting the same issue with the SDK. That just reinforces my belief that it has something to do with my account. I already generated multiple API keys and none of them work.

---

<div class="post-metadata">

**Author:** ![cslim](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/cslim/32/46_2.png) [@cslim](https://forum.alpaca.markets/u/cslim)\
**Post date:** [June 2, 2020, 4:54pm UTC](https://forum.alpaca.markets/t/polygon-stream-authentication-failed/1618/6 "2020-06-02T16:54:04Z")

</div>

check your wss uri. Looks like it may be wrong.

---

<div class="post-metadata">

**Author:** ![NetArchitect](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/netarchitect/32/834_2.png) [@NetArchitect](https://forum.alpaca.markets/u/NetArchitect)\
**Post date:** [June 2, 2020, 5:08pm UTC](https://forum.alpaca.markets/t/polygon-stream-authentication-failed/1618/7 "2020-06-02T17:08:18Z")

</div>

That’s what in the documentation =\> [https://alpaca.markets/docs/api-documentation/api-v2/polygon-integration/](https://alpaca.markets/docs/api-documentation/api-v2/polygon-integration/)

---

<div class="post-metadata">

**Author:** ![cslim](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/cslim/32/46_2.png) [@cslim](https://forum.alpaca.markets/u/cslim)\
**Post date:** [June 2, 2020, 5:13pm UTC](https://forum.alpaca.markets/t/polygon-stream-authentication-failed/1618/8 "2020-06-02T17:13:47Z")

</div>

hmm…yeah would definitely say it must be an account issue.

```auto
You will see an authentication error message saying “invalid API key” if your account does not have Polygon access.

```

---

<div class="post-metadata">

**Author:** ![cslim](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/cslim/32/46_2.png) [@cslim](https://forum.alpaca.markets/u/cslim)\
**Post date:** [June 2, 2020, 5:18pm UTC](https://forum.alpaca.markets/t/polygon-stream-authentication-failed/1618/9 "2020-06-02T17:18:05Z")

</div>

The only other thing I could think would be the way the syntax is in the code?? I am no C# master though, lol.

```auto
{
        "action":"auth",
        "params":"YOUR_API_KEY"
}

```

---

<div class="post-metadata">

**Author:** ![NetArchitect](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/netarchitect/32/834_2.png) [@NetArchitect](https://forum.alpaca.markets/u/NetArchitect)\
**Post date:** [June 2, 2020, 11:14pm UTC](https://forum.alpaca.markets/t/polygon-stream-authentication-failed/1618/10 "2020-06-02T23:14:12Z")

</div>

Verified. Syntax is correct.

---

<div class="post-metadata">

**Author:** ![joshw](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/joshw/32/8049_2.png) [@joshw](https://forum.alpaca.markets/u/joshw)\
**Post date:** [August 28, 2020, 6:37pm UTC](https://forum.alpaca.markets/t/polygon-stream-authentication-failed/1618/11 "2020-08-28T18:37:24Z")

</div>

Were you ever able to figure this out? Im having the exact same problem.

---

<div class="post-metadata">

**Author:** ![paul\_K](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/paul_k/32/1749_2.png) [@paul\_K](https://forum.alpaca.markets/u/paul_K)\
**Post date:** [December 23, 2020, 5:12pm UTC](https://forum.alpaca.markets/t/polygon-stream-authentication-failed/1618/12 "2020-12-23T17:12:16Z")

</div>

Generating new keys fixed the authentication issue for me.
