1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    53
    Vote Rating
    0
    paul_todd is on a distinguished road

      0  

    Default Setting username and password in proxy/store

    Setting username and password in proxy/store


    How can I inside the store/proxy setup a username and password to access a web service/rest/ajax etc without prompting?

    For example I have a delicious account I want to retrieve a set of urls from, for this I need to supply a username and password in order to login and get the data from my account

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,399
    Vote Rating
    128
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Is this standard HTTP/Basic Auth or some other mechanism?
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    53
    Vote Rating
    0
    paul_todd is on a distinguished road

      0  

    Default


    For now basic auth - specifically access to http://www.delicious.com/ which requires a username and password

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,399
    Vote Rating
    128
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    I learned this morning that BasicAuth is nothing more than a header which has base64 encoded username:password.
    http://coderseye.com/2007/how-to-do-...h-in-ajax.html
    http://www.aswinanand.com/2009/01/ht...on-using-ajax/

    Setting the headers on the proxy object will enable you to do this.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  5. #5
    Sencha User
    Join Date
    Nov 2012
    Posts
    9
    Vote Rating
    0
    besimo is on a distinguished road

      0  

    Default


    And how can I access the header on JSONP? Via property extraParams?

  6. #6
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,399
    Vote Rating
    128
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    It's not possible directly on the client-side. Take a look at this stackoverflow question.

    http://stackoverflow.com/questions/4...cript-requests
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  7. #7
    Sencha User
    Join Date
    Nov 2012
    Posts
    9
    Vote Rating
    0
    besimo is on a distinguished road

      0  

    Default


    Did not solve my problem.

    I have now included a button, where I make manually an ajax call to URL.
    It is successful, also looking into the header -> Authorization parameter is set.

    Code:
    //try to contact the server
    var auth = 'XXX';
    var url = 'http://xxx';
    
    
    // ExtJS
    Ext.Ajax.request({
        url : url,
        method : 'GET',
        headers : { Authorization : 'BASIC ' + auth }
    });
    But the Authorization parameter is still missing in the JSONP requests. Same URL as above.

    When entering my Basic Auth information into the popup in the browser, every JSONP requests includes the Authorization parameter - but in an iOS Webview that popup does not appear and therefore I cannot enter the auth information.

    Any further help?

  8. #8
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,399
    Vote Rating
    128
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    It's not possible to send additional headers on a script tag/jsonp request.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

Thread Participants: 2

Tags for this Thread