B
B
beduin012016-11-07 16:56:23
RESTful API
beduin01, 2016-11-07 16:56:23

What is the best way to make an API for checking authorization?

I think how best to make an API for checking authorization. It is logical to assume that if I use REST everywhere, then I also need to send some JSON from the browser to the server. But the question is how best to design it?
{"auth":"status"} or what?
And then how to respond to the server? It's just obvious that there must be some kind of communication pattern. At least basic fields, but I can’t find any examples.
Plus a question. Suppose I want to invest some kind of token and data? Please show how it should be done in a normal way?
===

{
"data":
  {
   //полезные данные
  },
"errors":"", 
"meta": 
  {
    "token": // вся инфа о авторизации
      {
        // если я использую JWT
        // то мне его в виде JSON описывать?
        // или просто сделать: "token" : "base64..."
      }
  }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question