A
A
Alexander Yudaev2015-05-16 18:00:24
PHP
Alexander Yudaev, 2015-05-16 18:00:24

How to write an API for interacting with the site itself and for other sites?

the task is this:
there is a crm site written in php.
the logic is this, the user comes in and sees his data (projects, tasks, etc.). wrote on Slim framework and authorization token.
Now I want to write the client part.
option two, write a separate system based on AJAX requests. in principle, everything is simple, a separate front, a separate back.
crm.site.com front on html and js wrapped in php to store sessions. authorization occurs every time, with every request.
api.site.com backing to php and giving out json.
but I think it's better to do things differently.
so that crm addresses directly to api and remembers the session, and if an external resource, then authorization is needed.
How can it be easier to implement this?
I don’t want to write the client part on php templates, because if the project gains momentum, it may have to be rebuilt in the future to another programming language (client task) and Amazon databases.
and depending on the language on the client is not a good idea.
storage html5 is also not an option, because authorization is still required all the time.
can you advise how to implement this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Volegov, 2015-05-16
@Alex_mc

And where did you get the idea that permanent authorization is needed. You do it 1 time, get a token and then send it to all ajax requests. This is essentially the same session, only the server should not remember the user's state - for example, there is a questionnaire with 2 steps, the frontend should immediately send answers to 2 pages, and not send 1 page, and then the 2nd.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question