Skip to content

0.15.4

Compare
Choose a tag to compare
@endel endel released this 16 Jan 15:03
· 29 commits to master since this release
0148395

New Auth API (https://github.com/colyseus/colyseus/releases/tag/0.15.15)

Define callback for Auth state change:

client.auth:on_change(function (auth_data)
	if auth_data.user ~= null then
		-- logged in!
	else
		-- logged out!
	end
end);

Methods:

  • client.auth:get_user_data()
  • client.auth:register_with_email_and_password()
  • client.auth:sign_in_with_email_and_password()
  • client.auth:sign_in_anonymously()
  • client.auth:send_password_reset_email()
  • client.auth:sign_out()
  • (❌ OAuth not yet implemented) client.auth:sign_in_with_provider()

Example

client.auth.sign_in_with_email_and_password("[email protected]", "123456", function(err, auth_data)
    if err ~= nil then
      -- err.status
      -- err.message
    else
      print(auth_data.token) -- token
      pprint(auth_data.user) -- user data
    end
end)