carlosmoreeira Posted October 20, 2014 Share Posted October 20, 2014 Hello, I have been using cakePHP now for a couple projects now. My next projects involves creating a web service and the entire front-end be built in angularjs. Now, I understand how 'Form' Authentication works, and have done some research and people tell me if I have an SSL to use Basic Auth, for a web service, which is what I am using. But I am having a problem hooking both up nicely. Now with angular, I have a call for a page and send over the username and password. If the credentials are correct, the server returns back the correct data. The problem is if the credentials are wrong, I get the normal 'Basic Auth' pop up, asking me for my username and password. My question is, instead of the server trying to re access the same page, is there a way to return json data back? Example : I have an angular call going to 'cakerest/projects.json' -> Credentials are ok -> Data is returned, and with javascript I console.log it and see it. 2nd time I send the incorrect user and password, and the server responds back with a popup asking for credentials. How can I get rid of that popup and just return "{Error : 'Credential problem'}; I can post code if that would help as well. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/291934-cakephp-basic-auth-popup/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.