O
O
Ostap2020-05-15 16:07:30
JavaScript
Ostap, 2020-05-15 16:07:30

Deal with the API?

Hello. I'm trying to build a react app. It should work with the API. There is no documentation. There is only a list of methods.
I don't understand how to work.
The API has a method for obtaining a token (authorization). But then this token is not involved in any of the following methods.
What to do with this token? (can be stored in cookies or local storage)
How will the server understand that I am authorized on the next request?
Thank.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander Dokin, 2020-05-15
@Your_Uncle_Ostap

Judging by the link provided in the comments, bearer authentication is used there.
Having received the token after authorization, pass it in the request headers in the form:
Authorization: Bearer awesome-token-12345
This is how the server will understand who exactly the request is coming from
https://swagger.io/docs/specification/authenticati...

K
Kerman, 2014-01-19
@VitaminPSG

Two tables are not needed in this case. Absolutely useless, senseless and merciless overengineering. You are just tormented to do LEFT JOIN with and without a reason, and maintain the integrity of such a bundle.
First of all, you need to optimize so that it is easier to work. And only then, when it works, and if it slows down, then and only then optimize performance.
And if there are only 40k records in the table, then this will not slow down (unless you run the database on the calculator) and small performance problems will be solved by a competent arrangement of indexes in the table.

R
Rsa97, 2014-01-18
@Rsa97

If TIME is real time, then one table, if a limited non-expandable list ("morning", "afternoon", "evening", "night") - one table with ENUM, if an expandable list, then two tables.

S
Sergey, 2014-01-19
@VitaminPSG

The table represents the stop time of the transport. Time is represented by INT and is equal to hour*60+minutes. The number of records in the table is about 40k. Different TIME value up to 1k.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question