Authenticate user with PHP/Backend



I am using the same “[Groceries](” tutorial to learn and understand iOS app development through NativeScript. However, I am having some trouble.

If I click on “Sign In” button, I see “Sorry, we could not find your account”.

The backend api URL is returning this line. For testing purpose, the backend api code do not interacts with database etc. It just throws this below line.

{“error”:0,“data”:{“username”:“nativeS”,“password”:“anything”,“role”:“user”,“id”:“anyid”,“access_token”:“I am the token”}}

My code are all 100% same. The only different is the “apiURL” - the URL i am using returns the above JSON.

I want to know what makes it say “Sorry, we could not find your account”. Is the returning code from API URL is good ?



Hi, so what you basically try to do is to rebuild the backend service, right? :slight_smile:

The first indicator to answer your question can be found at
around line 47.
there you can see that it takes the response json and passes Result.access_token to the Backenend service.

BackendService saves that token via the application settings and thus its available to the rest of the app.

That token would later be used for all calls of the grocery service to authenticate every service call.
For login, it, just sufficient taht the service call does not return an error.

Hope this helps to understand whats going on :slight_smile:


Thank you ! Just some more guidance I need.

Actually, can you see the JSON that I put in the original question. Is that correct for this script to understand and process the rest ?

Also, does my script need to return any HEADER / Response code too ? like 200, 250 etc etc ?


I think you posted all of 16 hours ago and did get a good response, so I don’t think the community has been slow to respond. Here we are on a Saturday evening, taking a look at this because it was flagged.

Sounds like you have several issues. I think you should resolve them one at a time on separate threads. What is the most pressing?


Well yeah, I understand that its weekend, anyways, the most important problem at the moment is that I can’t run any app in IOS nor in Windows. The reason is already there in my earlier post. Hope someday someone will put some lights on that.


Thank you people, finally, I have managed to do it my self.


Great, can you post your solution here so we can learn? thanks!


You should ask for your money back, hehe