Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as C# by 3da ( 5 years ago )
//Teeworlds Server sends token to client
            var serverToken = RandomStr();

            //Client sends request to Auth server (wrong pw)
            var authResult = await authService.Authenticate("3da", "12345", serverToken);

            Assert.IsFalse(authResult.IsSuccess);


            //Client sends request to Auth server (correct pw)
            authResult = await authService.Authenticate("3da", "123", serverToken);

            Assert.IsTrue(authResult.IsSuccess);

            //Client sends token to Teeworlds Server

            //Teeworlds server validates token (wrong token)
            var validateResult2 = await authService.Validate("3da", "wrong_token", serverToken);

            Assert.IsFalse(validateResult2.Success);

            //Teeworlds server validates token (wrong requset token)
            validateResult2 = await authService.Validate("3da", authResult.Token, "wrong_token");

            Assert.IsFalse(validateResult2.Success);

            //Teeworlds server validates token (correct tokens)
            validateResult2 = await authService.Validate("3da", authResult.Token, serverToken);

            Assert.IsTrue(validateResult2.Success);

 

Revise this Paste

Children: 103193
Your Name: Code Language: