# {"code":16,"message":"Server key invalid"}

**URL:** <https://forum.heroiclabs.com/t/code-16-message-server-key-invalid/5674>\
**Category:** Local Setup\
**Created:** [September 26, 2024, 7:18am UTC](https://forum.heroiclabs.com/t/code-16-message-server-key-invalid/5674 "2024-09-26T07:18:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajino2k](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/ajino2k/32/2357_2.png) [@ajino2k](https://forum.heroiclabs.com/u/ajino2k)\
**Post date:** [September 26, 2024, 7:18am UTC](https://forum.heroiclabs.com/t/code-16-message-server-key-invalid/5674/1 "2024-09-26T07:18:09Z")

</div>

Hi all,

please help me debug error “server key invalid”

config docker compose:  
exec /nakama/nakama --name nakama1 --database.address postgres:localdb@postgres:5432/nakama --logger.level INFO --session.encryption\_key ‘defaultencryptionkey’ --runtime.http\_key ‘defaultkey’ --socket.server\_key ‘defaultkey’

bash shell cCurl

RESPONSE=$(curl -s -X POST “http://$HOST:$PORT/v2/account/authenticate/email”   
-d “{"email":"$EMAIL","password":"$PASSWORD"}”   
-H “Content-Type: application/json”   
-H “Authorization: Basic $(echo -n $SERVER\_KEY | base64)”)

result:  
Authentication failed. Response: {“code”:16,“message”:“Server key invalid”}

I have check at nakama console port 7351, I see --socket.server\_key=defaultkey, but why not notification server key invalid

---

<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:** [September 26, 2024, 2:55pm UTC](https://forum.heroiclabs.com/t/code-16-message-server-key-invalid/5674/2 "2024-09-26T14:55:15Z")

</div>

Hello @ajino2k

Is the `$SERVER_KEY` var correctly set?

I’d advise to use curl with the -v option and --user option instead of setting the Authorization header yourself, something like:

```auto
RESPONSE=$(curl -v -s -X POST "http://$HOST:$PORT/v2/account/authenticate/email"
-d "{"email":"$EMAIL","password":"$PASSWORD"}"
-H "Content-Type: application/json"
--user "$SERVER_KEY:"

```
