Jump to content

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/291934-cakephp-basic-auth-popup/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.