A
A
Artem00712017-01-27 20:13:20
PHP
Artem0071, 2017-01-27 20:13:20

How to organize API validation?

Good afternoon!
Let's say we have 2 sites:

  • example.com (angularJS)
  • api.example.com (PHP)

How to send a request from the first to the second view
$http({
  method: 'GET',
  url: 'http://api.example.com/someMethod?param1=1&param2=2'
})

How to check api.example that we received a request from our base domain?
I thought that it was possible to pass some &key=mySuperHashKey along with the parameter, but then I realized that any fool could see it (provided that we only have JS (AngularJS) on the base domain))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2017-01-27
@Sanasol

Making direct requests there is not forbidden in any way with curl, for example.
And the browser can be "disabled" through CORS. Make a whitelist of domains.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question