Hello,
I turn on "use encryption" in zone configuration.
then I got error when unity client trying to connect:
"Login rejected. Client is not using an encrypted connection"
The code:
SFS = new SmartFox();
SFS.AddEventListener(SFSEvent.CONNECTION, OnConnection);
SFS.AddEventListener(SFSEvent.CONNECTION_LOST, OnConnectionLost);
SFS.AddEventListener(SFSEvent.LOGIN, OnLogin);
SFS.AddEventListener(SFSEvent.LOGIN_ERROR, OnLoginError);
SFS.AddEventListener(SFSEvent.EXTENSION_RESPONSE, OnServerResponse);
SFS.AddEventListener(SFSEvent.PUBLIC_MESSAGE, OnPublicMessage);
SFS.AddEventListener(SFSEvent.ROOM_JOIN, OnJoinRoom);
SFS.AddEventListener(SFSEvent.SOCKET_ERROR, OnSocketError);
SFS.AddEventListener(SFSEvent.CRYPTO_INIT, OnCryptoInit);
roomName = Guid.NewGuid().ToString();
ConfigData cfg = new ConfigData();
cfg.Host = ip;
cfg.Port = port;
cfg.HttpPort = httpPort;
fg.HttpsPort = httpsPort;
cfg.Zone = zone;
SFS.Connect(cfg);
in OnConnection ():
bool success = (bool)evt.Params["success"];
if ((bool)evt.Params["success"])
{
SFS.Send(new Sfs2X.Requests.LoginRequest(username,password,zone));
}
what do I have to add in client connection to not get the error?
Thanks
when use encryption there is error: Login rejected. Client is not using an encrypted connection:
Re: when use encryption there is error: Login rejected. Client is not using an encrypted connection:
Hi,
I suppose you're using Unity, correct?
If so take a look here:
http://docs2x.smartfoxserver.com/Gettin ... yptography
(there's a specific example for Unity)
Also keep in mind that when turning on encryption you will need a signed SSL certificate installed on your production server. Testing locally is not possible as self signed certificates will still cause a security error.
Cheers
I suppose you're using Unity, correct?
If so take a look here:
http://docs2x.smartfoxserver.com/Gettin ... yptography
(there's a specific example for Unity)
Also keep in mind that when turning on encryption you will need a signed SSL certificate installed on your production server. Testing locally is not possible as self signed certificates will still cause a security error.
Cheers
Re: when use encryption there is error: Login rejected. Client is not using an encrypted connection:
Thank you for your answer
It helped me a lot!
It helped me a lot!
Re: when use encryption there is error: Login rejected. Client is not using an encrypted connection:
Hi
after I succeed connect to ws://MyPublicIP:8080
I want to connect to wss://MyPublicIP:8443
I did the steps according: http://docs2x.smartfoxserver.com/Gettin ... yptography
open Port 8443 on fireWall
I try to run the example "AdvencedConnector" to connect server on MyPublicIP(install on vm)
while useEncryption = true;
and build the unity by WEBGL
I Got error connection: VM46:164 WebSocket connection to 'wss://brill-enviro-server.westeurope.cloudapp.azure.com:8443/websocket' failed: Error in connection establishment: net::ERR_CERT_INVALID
but when I useEncryption = false;
the connection is succeed.
tanks
Debby
after I succeed connect to ws://MyPublicIP:8080
I want to connect to wss://MyPublicIP:8443
I did the steps according: http://docs2x.smartfoxserver.com/Gettin ... yptography
open Port 8443 on fireWall
I try to run the example "AdvencedConnector" to connect server on MyPublicIP(install on vm)
while useEncryption = true;
and build the unity by WEBGL
I Got error connection: VM46:164 WebSocket connection to 'wss://brill-enviro-server.westeurope.cloudapp.azure.com:8443/websocket' failed: Error in connection establishment: net::ERR_CERT_INVALID
but when I useEncryption = false;
the connection is succeed.
tanks
Debby
Re: when use encryption there is error: Login rejected. Client is not using an encrypted connection:
Hi,
if the above url is the one you have used I can't connect at all. There's no port listening on 8443.
Maybe the server is down?
In any case, the error you have reported seems to indicate that there is a problem with the certificate. What domain does you SSL certificate works for?
Thanks
if the above url is the one you have used I can't connect at all. There's no port listening on 8443.
Maybe the server is down?
In any case, the error you have reported seems to indicate that there is a problem with the certificate. What domain does you SSL certificate works for?
Thanks
Re: when use encryption there is error: Login rejected. Client is not using an encrypted connection:
Hello Im Using Unity3d and using the lastest client and sfs version. I have successfully encrypt my SFS server and was able to Successfully build a WebGL build and made the connection to my SFS server.
My issue is I'm not able to connect to my SFS server via Unity Editor. I would have to build to a WebGL in order to check my change result which obviously makes thing so difficult to continue developing.
if I use the cfg.Port my server is unreachable but if I use the cfg.HttpsPort my server respond but with the message "Login rejected. Client is not using an encrypted connected". This is only happening inside my unity editor however everything works fine when I build to my WebGL.
My issue is I'm not able to connect to my SFS server via Unity Editor. I would have to build to a WebGL in order to check my change result which obviously makes thing so difficult to continue developing.
Code: Select all
// Set connection parameters
ConfigData cfg = new ConfigData();
cfg.Host = ServerIP;
//cfg.HttpPort = ServerPortHTP;
cfg.HttpsPort = ServerPortHTPS;
//cfg.Port = useEncryption ? ServerPortHTPS : ServerPortHTP;
cfg.Zone = GameZone;
// Connect to SFS2X
sfs.Connect(cfg);
if I use the cfg.Port my server is unreachable but if I use the cfg.HttpsPort my server respond but with the message "Login rejected. Client is not using an encrypted connected". This is only happening inside my unity editor however everything works fine when I build to my WebGL.
Re: when use encryption there is error: Login rejected. Client is not using an encrypted connection:
For WebGL projects (both inside the Editor and in the browser), this what we do in our example projects:
Code: Select all
sfs = new SmartFox(useEncryption ? UseWebSocket.WSS_BIN : UseWebSocket.WS_BIN);
ConfigData cfg = new ConfigData();
cfg.Host = hostName;
cfg.Port = useEncryption ? httpsPort : httpPort;
cfg.HttpPort = httpPort;
cfg.HttpsPort = httpsPort;
cfg.Zone = myZone;
// Connect to SFS2X
sfs.Connect(cfg);
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: when use encryption there is error: Login rejected. Client is not using an encrypted connection:
Bax wrote:For WebGL projects (both inside the Editor and in the browser), this what we do in our example projects:Code: Select all
sfs = new SmartFox(useEncryption ? UseWebSocket.WSS_BIN : UseWebSocket.WS_BIN);
ConfigData cfg = new ConfigData();
cfg.Host = hostName;
cfg.Port = useEncryption ? httpsPort : httpPort;
cfg.HttpPort = httpPort;
cfg.HttpsPort = httpsPort;
cfg.Zone = myZone;
// Connect to SFS2X
sfs.Connect(cfg);
Hello Bax ty for reply. I have used the exact config data you provide along with the sfs variable but Unity editor will not connect to my server. I would have to use this code in order to continue my development.
Code: Select all
if (!Application.isEditor)
sfs = new SmartFox(useEncryption ? UseWebSocket.WSS_BIN : UseWebSocket.WS_BIN);
else sfs = new SmartFox();
This is what it spit out.
Code: Select all
EntryPointNotFoundException: SocketCreate
Sfs2X.Core.Sockets.WebSocketHelper.Connect () (at <700c3576d7f44487bf7a8fabf00071ce>:0)
Sfs2X.Core.Sockets.WebSocketLayer.Connect (System.String host, System.Int32 port) (at <700c3576d7f44487bf7a8fabf00071ce>:0)
Sfs2X.Bitswarm.WebSocketClient.Connect (System.String host, System.Int32 port) (at <700c3576d7f44487bf7a8fabf00071ce>:0)
Sfs2X.SmartFox.Connect (System.String host, System.Int32 port) (at <700c3576d7f44487bf7a8fabf00071ce>:0)
Sfs2X.SmartFox.Connect (Sfs2X.Util.ConfigData cfg) (at <700c3576d7f44487bf7a8fabf00071ce>:0)
DatabaseManager.StartDataConnection () (at Assets/_Scripts/DatabaseManager.cs:58)
FacebookManager+<DownloadMyPhoto>d__13.MoveNext () (at Assets/_Scripts/FacebookManager.cs:124)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
DatabaseManager.cs:58 All that line says is sfs.Connect(cfg);
it works for now. I do have another plugin call Best HTTP https://assetstore.unity.com/packages/tools/network/best-http-10872 I detected that it clashes with Smartfoxserver sockets while having encryption enabled. Before I begin to remove the plugin throughout all my HTTP scripts I was wondering if you can help me figure out if it does because I'm not to savvy with network codes, especially when it comes to sockets.
Re: when use encryption there is error: Login rejected. Client is not using an encrypted connection:
Using this "if":
You are making the Editor connect over default socket, not WebSocket. Other than that, there's no difference.
I'm not sure if and why your other library can cause issue to the WebSocket connection side the Editor.
Could you please send us (privately) the address and ports of your server? I'd like to test the connection with my test client.
You can send us an email at info AT smartfoxserver DOT com.
Code: Select all
if (!Application.isEditor)
sfs = new SmartFox(useEncryption ? UseWebSocket.WSS_BIN : UseWebSocket.WS_BIN);
else sfs = new SmartFox();
You are making the Editor connect over default socket, not WebSocket. Other than that, there's no difference.
I'm not sure if and why your other library can cause issue to the WebSocket connection side the Editor.
Could you please send us (privately) the address and ports of your server? I'd like to test the connection with my test client.
You can send us an email at info AT smartfoxserver DOT com.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: when use encryption there is error: Login rejected. Client is not using an encrypted connection:
Hi Bax,
I sent my server info with a test user account via the email you just provided.
I sent my server info with a test user account via the email you just provided.
Who is online
Users browsing this forum: No registered users and 132 guests