I have an application with a series of webservices with a common token authentication. So each services gets passed in a token and if it's valid then the webservice continues and returns the appropriate type.
[WebMethod]
public List<Student> getStudents(string schoolID, string authToken)
{
var authenticate = new Authenticate();
var authorized = authenticate.ValidateAuthorizationToken(authToken);
if (authorized)
{
// Do something and return a type (in this case a list of Student)
}
else
{
// return null?
}
}
My question is do I just return null if the token is invalid? I could return an error message but I have several different services and some return strings, some return lists, some bool etc. If a list is the return type how do I indicate a invalid token?