Using Defold / Nakama

On local session = nakama_session.create() i’m passing in my token result and its telling me it needs a token. I’m kinda lost on what its looking for any suggestions?

local function authenticate_with_device(client)
nakama.sync(function()
local vars = nil
local create = true
local result = nakama.authenticate_device(client, defold.uuid(), vars, create, “wack24”)

	if not result.token then
		print("Unable to login")
		return
	end

	-- store the token to use when communicating with the server
	print(result.token)
	nakama.set_bearer_token(client, result.token)

	
	-- store the token on disk
	local d = result.token
	local session = nakama_session.create(d)
	print(session.user_id)
	
end)

end

if anyone else has this issue I was able to get it to start session by passing the whole result in instead of result.token.

– store the token on disk
local d = result
local session = nakama_session.create(d)
print(session.user_id)

1 Like