# Nakama sometimes can't be authenticate

**URL:** https://forum.heroiclabs.com/t/nakama-sometimes-cant-be-authenticate/5876
**Category:** Local Setup
**Tags:** authentication
**Created:** [December 18, 2024, 11:19am UTC](https://forum.heroiclabs.com/t/nakama-sometimes-cant-be-authenticate/5876 "2024-12-18T11:19:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![amhakunrealdev](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/amhakunrealdev/32/2600_2.png) [@amhakunrealdev](https://forum.heroiclabs.com/u/amhakunrealdev)
#### Post date: [December 18, 2024, 11:19am UTC](https://forum.heroiclabs.com/t/nakama-sometimes-cant-be-authenticate/5876/1 "2024-12-18T11:19:01Z")

</div>

Hi Devs,  
I need some help with my Nakama, which sometimes does not authenticate properly. When it can’t authenticate, it will throw an error like heartbeat failure in logs.  
Even if it is successful in auth, it will disconnect by itself for some time and say:  
`Peer didn't specify a reason for initiating the closing`.

I already put the session expiry as 2 hours but it disconnects less than that

```auto
session:
  token_expiry_sec: 7200 # 2 hours

```

1. Versions: Nakama {2.8.2}, {Windows}, {unreal C++ version}

2. Server Framework Runtime language {Go}

---

<div class="post-metadata">

### Author: ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)
#### Post date: [December 18, 2024, 11:29am UTC](https://forum.heroiclabs.com/t/nakama-sometimes-cant-be-authenticate/5876/2 "2024-12-18T11:29:33Z")

</div>

Hello @amhakunrealdev,

This doesn’t seem to be related to token expiry, if you’re using the Nakama Unreal SDK then you should upgrade to latest (v2.10.0). Please also make sure you’re on the latest Nakama server version (v3.25.0).

Client authentication is done via REST API, and realtime socket cannot be established with the server unless the client has a valid auth token from successful authentication - so I’m not sure I understand the flow here, can you please provide a more detailed account of the steps to reproduce the issue, as well as more detailed log entries for both client and server of when this happens, otherwise it’s difficult to help.

Best.

---

<div class="post-metadata">

### Author: ![amhakunrealdev](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/amhakunrealdev/32/2600_2.png) [@amhakunrealdev](https://forum.heroiclabs.com/u/amhakunrealdev)
#### Post date: [December 19, 2024, 4:00am UTC](https://forum.heroiclabs.com/t/nakama-sometimes-cant-be-authenticate/5876/3 "2024-12-19T04:00:58Z")

</div>

Thank you so much for your response. I will first update the Nakama server and SDK versions. If the issue persists, I will provide a more detailed account of the steps to reproduce it
