Hello,
I have a question I can't solve.
When a user is not logged in and tries to access an action needing loading,
he is redirected to my login page. That's normal.
But, for my API, I use Basic Auth, but I want that if a user is not logged
in, he is prompted with a message like "This action requires
authentication" instead of displaying the loggin page. How can I achieve
this ?
This is my app controller code, in the beforeFilter function to see if it's
an api request :
$url = Router::parse(Router::url()); // parse the url
$type = $url['action']; // check if it's API or not
if ($type == 'api') { // if API, use basic auth
$this->Auth->authenticate = array('Basic');
}
Thanks a lot for your time !
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.