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

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

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:

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:"