//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);
Add a code snippet to your website: www.paste.org