Yii2 Login and Logout using API

Hi,

I am trying to implement login and logout functionality using an API on my frontend project but I don’t get any luck on making it work properly.

I am using basic javascript and ajax to connect with the API.

I created the ff files, to begin with from the random samples I see.

WebUser.php

Service.php

config/web.php

Then on my login function I call this:
Service::do_login($this->_user_info);

Please help.

Thanks,

J

You need to use headers and store them and use when you want to make a request to server