Jump to content

CORS phonegap/cordova


Manol
 Share

Recommended Posts

I would like to create a page that uses a template that returns some data, as "pages web service" but this template can be accessed only by certain role.

Then a user must send credentials through ajax to get the data back , the http call comes from a phone, so the page trying to access the data is not on the server, is there a way to do it?

I've search all around the forum but no way to get it working. Anybody has done something similar? How did you solve it?

Thank you.

Link to comment
Share on other sites

A webservice is in no way different to a normal website besides the fact that it's returning different data, e.g. json instead of html. Build it like you normally would, but let the template output json. You just need to be aware, that the usage of sessions and session cookies, which power the authentication in processwire, are not the best option for webservice authentication. 

Link to comment
Share on other sites

I got hands on experience with Cordova however am curious you can't have CORS issues with Cordova, because that limitation doesn't affect cordova however check your <access> tag in the config.xml.

Feel free to ask any question. 

Link to comment
Share on other sites

Hi Sephiroth.

    

    I can get data back if the template that the page uses has a guest role.

    I don't have any problem with cordova when I use it with dreamfactory I can login retrieve data upload images... but because I like pw I would like to do the same with it but as mentioned before I'm not able to retrieve data from a page that uses a template with a role different to guest.

    The problem is my knowledge I suppose making calls through ajax to log to pw and get the data back. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...