Hello thanks for the reply,
First sorry I past the wrong code, here is the code I’m using:
--NETWORKHANDLER
networkHandler = {}
local nakama = require "core/network/nakama"
local log = require "core/network/util/log"
local love = require "core/network/engine/love"
local function device_login(client)
local uuid = "5c251fc8-5643-4403-c433-04ed336b0dff"
local result = client.authenticate_device(uuid, nil, true, "shioridotdev")
if result then
if result.token then
client.set_bearer_token(result.token)
return true
end
end
print("Unable to login")
return false
end
function networkHandler:load()
log.print()
local config = {
host = "localhost",
port = 7350,
engine = love,
username = defautlkey,
password = "",
timeout = 10
}
local client = nakama.create_client(config)
nakama.sync(function()
device_login(client)
end)
end
And here is the function that I print the output (function M.http(config, url_path, query_params, method, post_data, callback) part of the nakama defold engine):
print(http.request(url, method, function(self, id, result)
log(result.response)
local ok, decoded = pcall(json.decode, result.response)
if not ok then
result.response = { error = true, message = "Unable to decode response" }
elseif result.status < 200 or result.status > 299 then
result.response = { error = decoded.error or true, message = decoded.message, code = decoded.code }
else
result.response = decoded
end
callback(result.response)
end, headers, post_data, options))
And the result ouput:
authenticate_device() with coroutine
HTTP table: 0x010e19ff48 http://localhost:7350/v2/account/authenticate/device?username=shioridotdev&create=true
DATA {"id":"5c251fc8-5643-4403-c433-04ed336b0dff"}
{"code":3, "message":"invalid character 'P' looking for beginning of value"} 400 table: 0x010e1a36e0 HTTP/1.1 400 Bad Request```