Answer the question
In order to leave comments, you need to log in
How to make a private API?
I'm making a private API for a site, but I can't figure out how to properly implement its privacy. That is, how to make this API just for the application.
That is, how to make it so that only the application has access to this API. There is an idea - to use a password for the apishka, that is, send a POST request like site.com/api/password=123456
And on the server organize it like this
const PASSWORD = '123456';
$password = Yii::$app->get('password');
if ($password != PASSWORD) header('HTTP/1.0 403 Forbidden');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question