//Teeworlds Server generates "request token"
var serverToken = RandomStr();
//Teeworlds Server sends "request token" to client
//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 "request 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