Yii2 Restful Backend and Angular Frontend - Need help - Auth Clients

Hi Guys/Girls,

I need your help, I have been trying to get authclient working for Rest but was unable to do so. My application built is on Yii2 is restful and I need to login the user and send auth-token to them.

If somebody can please help


Wenceslaus Dsilva


Usually how I do it is to handle login and everything using Yii, and once user is logged I AngularJS application is called. Angular application then takes care for everything including access rights and everything else.

Othere way is to make for example REST service which will listen for username and password. When credentials are good, generate session or any other key for user and during any subsequent calls make sure user is logged in.

Thank you for you suggestion, but that wont work for me as we have already finished most of the application and changing that will be longer time. I see the yii authclient and seems we can use it but I just can find the right way.

Have you tried a token based login system instead of session?

Yes I have token based system for email and password signin but i want to do the social media login and I cant figure out how

Would this help?

Thank you Janisto but that did not help I have built the Yii application to server as RestFul Service and angularJs is used only from front end making api calls

What have you tried so far? We can’t help you if all you tell us is “it didn’t work”

I have tried facebook login and got it working, I created a component for Facebook, so the Facebook SDK js which logs in and gets the access code, and the callback is used to make a call to the api I have created which in turn gets me the access token for the other api’s.

But its not very concrete I saw the authclient and thought it would be easier to use it but could not find any examples