Error while passing the api method

Hello,

I’m doing a client Library for Love2D using the Defold client one.
Everything is working as except, but I got an issue passing the method in the HTTP request.

I’m guessing that the JSON in the body is wrong but why only the method is making and issue.
Here is the error output I got.

authenticate_email() with coroutine
HTTP    POST    http://localhost:7350/v2/account/authenticate/email?username=britzl&create=true
DATA    {"email":"bjorn@defold.se","password":"foobar123"}
{"code":3, "message":"invalid character 'P' looking for beginning of value"}    400     table: 0x010de8ac28     HTTP/1.1 400 Bad Request

Hi,

I am not sure I understand what do you mean by “passing the method in HTTP request”. You seem to be using authenticate_email function, which doesn’t accept HTTP method in any of its arguments.

Would you mind providing code snippet where you see the problem?

Thanks

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```

Hello !

Did you find something about my issue?

Still stuck on it ^^