×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    29

    Phone asks for credentials when trying to authenticate over OAuth

    Hi,

    I want to connect to an webservice that uses OAuth. I am using a javascript library from http://code.google.com/p/oauth/sourc...ode/javascript for that. Everything works fine in Aptana Studio. When I run the widget on my Nokia 5800 it asks for user credentials when making an connection to the service.


    Here is the source code i'm using.

    Code:
        var requestBody = OAuth.formEncode(message.parameters);
        OAuth.completeRequest(message, accessor);
        var authorizationHeader = OAuth.getAuthorizationHeader("", message.parameters);
    
        var requestToken = new XMLHttpRequest();
        requestToken.onreadystatechange = function receiveRequestToken() {
            if (requestToken.readyState == 4) {
    			//requestToken.status is 0
            }
        };
    
        requestToken.open(message.method, message.action, true);  // method = POST, action = https://something.onthe.net/oauth
        requestToken.setRequestHeader("Authorization", authorizationHeader);
        requestToken.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        requestToken.send(requestBody);
    It basically uses the OAuth library to build the authorization header and sends the request via a XMLHttpRequest. The method is POST and the message.action is an HTTPS url.

    The problem is, that the phone asks for user credentials (OS dialog). Why does it ask, when I have supplied an Authorization header and the webservice does not require credentials?

    I have tried to input a username and a passwort but after hitting OK the phone says authentication failed. If I hit Cancel the status of the requestToken is 0. I'm guessing the XMLHttpRequest was not sent.

    Any help greatly appreciated.

  2. #2
    Registered User
    Join Date
    Jan 2008
    Posts
    29

    Question Re: Phone asks for credentials when trying to authenticate over OAuth

    Does anybody use OAuth with WRT or any other form of authentication that uses the authorization header? I am thinking this is a common procedure to access web services.

    Otherwise, I think this might be a problem with the way the WRT is handling HTTP Request with an authorization header, or how it reacts on connecting to a service that needs an authorization header. IIRC the authorization header is used with htaccess protected websites, where it makes perfect sense to ask for user credentials. Maybe someone from Nokia could have a look at that?! Is there a way to submit bug reports?

  3. #3
    Registered User
    Join Date
    Nov 2008
    Posts
    13

    Re: Phone asks for credentials when trying to authenticate over OAuth

    Hi,

    I have not tried your example, but I'm having a similar problem with reading a header from the XHR in the 'regular' browser.
    My guess is that the browser, and hence the runtime, has limited support for reading headers.

    It unfortunate that the limitations of the browser/runtime are not properly documented - at least I have not found this information anywhere. Another example would be the weirdness with regular mouse events.

    Best Regards,
    Marc

  4. #4
    Registered User
    Join Date
    Feb 2009
    Posts
    21

    Re: Phone asks for credentials when trying to authenticate over OAuth

    The 'authorization' http header is not supported in the Web Runtime engine. Nor are many other standard or custom headers. See this wiki page: Using widgets to access web services.

    This effectively means you cannot use OAuth at the moment.

  5. #5
    Registered User
    Join Date
    Sep 2003
    Posts
    25

    Re: Phone asks for credentials when trying to authenticate over OAuth

    Then, how can people develop web service that require custom Header?

Similar Threads

  1. Replies: 6
    Last Post: 2008-10-15, 07:44
  2. Asterisk REregister failing
    By kolbi-nokia in forum VoIP
    Replies: 6
    Last Post: 2007-08-15, 19:13
  3. Connecting from PC to phone via RFCOMM, OBEX
    By buzz111 in forum Symbian
    Replies: 4
    Last Post: 2007-03-01, 05:48

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×