Search code examples
authenticationserverresponse

Server response when user was authenticated


I am poking around client-server communication, and I am stuck on a problem, where I don't know what the server should respond with, when the user authentication has been successful, or not. Do I want to respond with just a "True" or "False", or are there more intricate responses when designing a server?


Solution

  • I think you can return

     {"state":500, "msg":"auth failed"}
    

    for interfaces that need that auth. And return actual data

    {"data":{"twits":[...]}} 
    

    for non-auth-required interfaces