1. #1
    Sencha User kitesurf's Avatar
    Join Date
    Jan 2012
    Location
    London, England
    Posts
    73
    Vote Rating
    3
    Answers
    4
    kitesurf is on a distinguished road

      0  

    Default Unanswered: JSONP & How to handle authentication

    Unanswered: JSONP & How to handle authentication


    I have a Sencha application running on one server and a back-end web service running on a separate server which provides the Sencha application with it's data as well as authentication. Both servers are secured with HTTPS.

    I originally had my Sencha app using just JSON to communicate with the back-end, but it meant having to keep both servers on the same domain. Ajax calls do not allow cross-domain communications.

    As an aside, you can actually allow cross-domain communications, but it seems mobile browsers do not support it. See here.

    When using JSON, I did a HTTP POST to the back-end server to handle authentication with the username and password in the HTTP header. However, it's not possible to do POST requests using JSONP, so how does one go about sending the username and password to the back-end?

    I could of course just do a GET request and have the username and password in the URL but this is surely a big no no since the URL is still sent as plain text even on a HTTPS connection.

    So I am looking for a bit of direction on how to go about this. I am sure this is something that has cropped up previously. Perhaps I have no choice but to have both applications running on the same server?

    Any advise would be great.

    Thanks

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    Answers
    3574
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You will need to enable CORS to do POSTS, there is no way to do JSONP as GET as it's just a <script> tag.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread