We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

[SOLVED] Oxwall REST authentiaction issues | Forum

Cesare
Cesare Jan 7 '15
Hello,
I'm developing a iPhone app for OW, I'm having the following issue:
When privacy settings "Guests can view the site" is set to YES I can access to my plugin where I wrote a custom authentication method.
But, if the privacy settings "Guests can view the site" is set to NO I can't reach my code plugin.

The option I have now are the following:
1- Hack the core files -> :(
2- Make a POST to the signin form and parse the HTML -> :|

So I was wondering if OW offer any other opportunity, like JSON/XML friendly authentication method, API-like.

If not, what would be the cleanest approach to modify the core files ?

Thank you :)

EDIT:

I've just noticed that there is a /api route in the default installation, but I'm getting
{"message":"Can't dispatch request! Please provide valid controller class!","file":"\/opt\/local\/apache2\/htdocs\/agamaloka\/ow_core\/api_request_handler.php","line":110,"trace":"#0 \/opt\/local\/apache2\/htdocs\/agamaloka\/ow_core\/api_application.php(194): OW_ApiRequestHandler->dispatch()\n#1 \/opt\/local\/apache2\/htdocs\/agamaloka\/index.php(73): OW_ApiApplication->handleRequest()\n#2 {main}","type":"Exception","class":"LogicException"}

The Forum post is edited by Cesare Feb 18 '15
Cesare
Cesare Feb 18 '15
Found a solution ^_^
/base/user/ajax-sign-in offers a sign in via ajax, even if the website is not available for guests.

How to use

Method: POST

Required params:
  • form_name: "sign-in"
  • identity: «username»
  • password: «password»
  • remember: ["on"|"off"]

  • Required headers (MUST):
    • X-Requested-With: XMLHttpRequest
      if missing, the controllers returns 404 page.
    • User-Agent: something_not_recognized_as_mobile_user_agent
      if it contains "iPhone" or "android" anywhere the mobile version kicks in an the controller is no longer reachable.

    Happy coding :)
    The Forum post is edited by Cesare Feb 18 '15