How can we organize a simple authorization?
Options
DragoN
✭
in Photon Bolt
Tell me please. How can we organize a simple authorization?
I can not understand how the client connection and how to insert the authorization.
Maybe there is an example of how to do it?
Sorry, I use a translator.
I can not understand how the client connection and how to insert the authorization.
Maybe there is an example of how to do it?
Sorry, I use a translator.
0
Comments
-
What do you mean by authorization?0
-
check the login and password for example0
-
The host can look at the token sent in the connect request and accept or reject the connection0
-
http://doc-api.photonengine.com/en/bolt/current/class_bolt_internal_1_1_global_event_listener_base.html#a7973dddc8f95010b268cc80fe9ec25d2
This will only be called in manual connect mode.0 -
Thanks a lot for your help.stanchion said:http://doc-api.photonengine.com/en/bolt/current/class_bolt_internal_1_1_global_event_listener_base.html#a7973dddc8f95010b268cc80fe9ec25d2
This will only be called in manual connect mode.
This method I've seen, but I can not figure out how to send this token from the client.0 -
Help once more please.
Following the example of creating a class and try to send it to the server.
But I get an error: BoltException: Unknown token type ConnectToken
Example:ConnectToken c = new ConnectToken(ServerController.LoginHash); BoltNetwork.Connect(serverAddr, c); public class ConnectToken : Bolt.IProtocolToken { public string Token = "0"; public ConnectToken(string token) { if (token == null) token = Random.Range(0, 999999).ToString(); Token = token; } void Bolt.IProtocolToken.Read(UdpKit.UdpPacket packet) { Token = packet.ReadString(); } void Bolt.IProtocolToken.Write(UdpKit.UdpPacket packet) { packet.WriteString(Token); } }
0 -
You need to register the token like in the tutorial.0
-
thx0
-
I can not understand. I have requests from clients do not come to ConnectRequest.
The client connects directly without any acknowledgment from server
Help plz.
connection from clientpublic override void BoltStartDone() { if (client) { ConnectToken c = new ConnectToken(ServerController.LoginHash); BoltNetwork.Connect(UdpKit.UdpEndPoint.Parse(serverAddress + ":" + serverPort),c); }
ConnectRequestusing System; using UnityEngine; using System.Collections; using Bolt; [BoltGlobalBehaviour] public class TokenCallbacks : Bolt.GlobalEventListener { public override void BoltStartBegin() { BoltNetwork.RegisterTokenClass<ConnectToken>(); BoltNetwork.RegisterTokenClass<TestToken>(); } public override void ConnectRequest(UdpKit.UdpEndPoint endPoint, IProtocolToken token) { print("ConnectRequest token " ); if (token is ConnectToken) { ConnectToken t = (ConnectToken)token; if (ServerController.CheckClientToken(t.Token)) { BoltNetwork.Accept(endpoint); } } } }
0 -
I did exactly like this
http://doc.photonengine.com/ja-jp/bolt/current/reference/iprotocoltoken0 -
http://forum.photonengine.com/discussion/comment/30680/#Comment_30680
"This will only be called in manual connect mode."0 -
that is, it is only called when the user input? the method onclick0
-
You can explain what it means to a manual connect mode?0
-
Manual connect mode is you write code and/or UI that makes the connection instead of Bolt auto connecting when it starts.0
-
I suffered in connection with the mouse function to call. but still ConnectRequest method is not called.
void Start(){BoltLauncher.StartClient()}; void OnClick(){ConnectToken c = new ConnectToken(ServerController.LoginHash); UdpEndPoint _serverEndPoint = new UdpEndPoint(UdpIPv4Address.Parse("127.0.0.1"), (ushort)3334); BoltNetwork.Connect(_serverEndPoint, c);}
can you have an example of how this can be done?0 -
We've explained this several times and you don't seem to be reading. You need to change the connect mode in Bolt settings. If you have more questions I suggest you join the Slack.0
This discussion has been closed.