LOGIN  |  REGISTER
Smart Living Made Brilliant!
CASTLEOS FORUM

HomeCastleOS API

Information, FAQs, Q&As, and everything else related to the CastleOS API can be found here

Web: Authentication not implemented Messages in this topic - RSS

Phil Hawthorne
Phil Hawthorne
Posts: 400


3/13/2016
Phil Hawthorne
Phil Hawthorne
Posts: 400
Not sure if this is by design.

When calling /CastleOS/service2/web/AuthenticateUser_PlainText from a web server like PHP, I get an error about calling this endpoint incorrectly.

When calling from the browser, using the example jQuery file the response is empty.

Then, when calling other endpoints, like GetAllScenes, the call works, even though my authentication doesn't have a token, just a username
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


3/13/2016
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
Hmm, you're right, it definitely wasn't doing that earlier. I must've changed something inadvertently, let me look into it...
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


3/13/2016
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
Correct me if I'm wrong, but you're getting "An authorization attempt provided improperly formatted credentials. Please try again." logged to the error log, but the data is still returned, and it shows "parsererror", correct?
0 link
Phil Hawthorne
Phil Hawthorne
Posts: 400


3/13/2016
Phil Hawthorne
Phil Hawthorne
Posts: 400
I haven't checked the error log. Let's try another call.

I have my PHP class able to turn off and on scenes and groups now. But not using any authentication.

So, calling a group power odds that error you mentioned to errors.xml. And returns "1" to the caller via HTTP (not JSON, just the string 1)
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


3/13/2016
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
I changed the error that's thrown when credentials fail, which apparently had the side effect of not blocking the request from going through. Hence why the credentials are bypassed.

Regarding the JSON, if you call it from jQuery or other frameworks, it abstracts it from you like I mentioned. Load it int he browser directly (click this link): http://localhost/CastleOS/service/web/GetAllGroups/

And you get this:

[{"key":"Default","value":"0"},{"key":"Ecobee Devices","value":"12"},{"key":"Hue Devices","value":"5"},{"key":"Living Room","value":"11"},{"key":"Living Room Chandelier","value":"8"},{"key":"Master Bedroom","value":"10"},{"key":"Nest Devices","value":"2"},{"key":"Office","value":"9"},{"key":"Sonos Devices","value":"1"},{"key":"Test 4","value":"7"},{"key":"Test Group 2","value":"6"},{"key":"WeMo Devices","value":"3"},{"key":"Z-Wave Devices","value":"4"}]
0 link
Phil Hawthorne
Phil Hawthorne
Posts: 400


3/13/2016
Phil Hawthorne
Phil Hawthorne
Posts: 400
Ha yes, VERY familiar with JSON wink

My only problem now is that any call I make to AuthenticateUser_PlainText either results in an error, or empty response.
0 link