Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor pillar's Avatar
    Join Date
    Feb 2006
    Posts
    112
    Hey, I am trying to make an AJAX call (GET) to a http site that uses Http Basic Authorization. It is able to do it, but it asks for the authorization every time.

    Is it possible to send them in the http request and not have the phone prompt for them every time? I think this is a must feature for anyone to have the patience to use the application. Thanks.

  2. #2
    Regular Contributor peppe@peppe.net's Avatar
    Join Date
    Dec 2007
    Posts
    60
    Quote Originally Posted by pillar View Post
    Hey, I am trying to make an AJAX call (GET) to a http site that uses Http Basic Authorization. It is able to do it, but it asks for the authorization every time.

    Is it possible to send them in the http request and not have the phone prompt for them every time? I think this is a must feature for anyone to have the patience to use the application. Thanks.
    In principle you should be able to use the username and password arguments in the open() method of XHR as the function is defined as:

    open(method, URL, async, userName, password)

    If that fails you can try by doing the authentication directly. HTTP basic authentication is done by adding an HTTP header called "Authorization" to the request. The value of the header should be "Basic" plus a space plus a Base64-encoded string of the username and password concatenated together with a colon in between. i.e. the value for the HTTP header is "Basic " + base64(username + ":" + password). You can find many Base64 libs for JavaScript online with a quick Google search, e.g. at this URL (Disclaimer: I haven't tested the code so I can't certify that it does what it claims to do):
    http://www.webtoolkit.info/javascript-base64.html

    You will find the full specification for HTTP basic authentication here:
    http://www.w3.org/Protocols/HTTP/1.0/spec.html#BasicAA

    Peppe

  3. #3
    Regular Contributor pillar's Avatar
    Join Date
    Feb 2006
    Posts
    112
    Thank you for the reply. I tried both of them, but didn't have any luck getting them to work. It still prompted for the authorization even when I added the header. Trying open method with username and password hanged the application.

    When I get back home, I will make more extensive testing. In the meantime, if someone has reportedly managed to get those to work, please let us know!

  4. #4
    Registered User darroyo's Avatar
    Join Date
    May 2008
    Location
    California
    Posts
    13
    Try this URL in your get: http://<username>:<password>@<yoursite>.com/anything.html

  5. #5
    Regular Contributor ferranhalden's Avatar
    Join Date
    Jan 2004
    Posts
    128
    this is working!!!
    My question is the following: if a send the wrong combination of username/password the framework will prompt the dialog for authorization. Is any possibility to avoid that dialog?

  6. #6
    Regular Contributor wildabeast's Avatar
    Join Date
    Aug 2009
    Posts
    57
    Would love to know if anyone has made progress on avoiding the authorization prompt when the initial authorization fails.

    Quote Originally Posted by ferranhalden View Post
    this is working!!!
    My question is the following: if a send the wrong combination of username/password the framework will prompt the dialog for authorization. Is any possibility to avoid that dialog?

  7. #7
    Registered User loukas1984's Avatar
    Join Date
    Dec 2009
    Posts
    5
    Some problem here with basic authentication on s60.

    Seems to be a bug.

    Can anybody help?

Similar Threads

  1. Basic HTTP question
    By pradeep_gct in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2004-12-21, 06:51
  2. Problem in HTTP Authorization
    By sinnchui in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2004-05-08, 05:36
  3. HTTP Basic authentication problem (MIDP1.0)
    By heccomm in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2004-01-16, 18:03
  4. Http basic authorization problem on 3650
    By antonzubenko in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2003-11-18, 08:46
  5. 6310i HTTP Authorization
    By adgame in forum Mobile Java General
    Replies: 0
    Last Post: 2002-08-26, 16:02

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved