XML-RPC User.login does not work - Mozilla

This is a discussion on XML-RPC User.login does not work - Mozilla ; Hi everyone, I try to use the XML-RPC-API of Bugzilla with Groovy-XMLRPC. I cannot access the User.login method for some reason. But I cannot figure out why. Can anyone tell me, what I am doing wrong? Code: def username = ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: XML-RPC User.login does not work

  1. XML-RPC User.login does not work

    Hi everyone,

    I try to use the XML-RPC-API of Bugzilla with Groovy-XMLRPC.

    I cannot access the User.login method for some reason. But I cannot
    figure out why. Can anyone tell me, what I am doing wrong?

    Code:
    def username = "mail@mail.com"
    def password = "mySecret"
    def serverUrl = "http://myserver.com/path/to/mybugzilla/xmlrpc.cgi"
    
    println("URL: " + serverUrl)
    
    def serverProxy = new XMLRPCServerProxy(serverUrl)
    
    def user = serverProxy.User.login(username, password)
    
    println("user: " + user)
    gets the error:
    [error]
    call Failure: fault string = "Can't use string ("mal@mail.com") as a
    HASH ref while "strict refs" in use at Bugzilla/WebService/User.pm
    line 39.
    : Server", fault code = 0
    [/error]

    Any hints?

    MArtin


  2. Re: XML-RPC User.login does not work

    MArtin,

    2007/6/25, MArtin :
    > def user = serverProxy.User.login(username, password)


    the method expects named parameters (as opposed to the list of values
    you're giving). I don't know the syntax of the tool you're using, but
    it needs to be something along the lines of
    serverProxy.User.login(login => username, password => password). See
    contrib/bz_webservice_demo.pl.

    Kind regards
    Marc

  3. Re: XML-RPC User.login does not work

    Hi Marc,

    sorry for the delay.

    that works. I pass a Map as Parameter and it works fine, I can perform
    the login.

    Thanks a lot!

    regards, MArtin

    On 25 Jun., 19:04, "Marc Schumann" wrote:
    > MArtin,
    >
    > 2007/6/25, MArtin :
    >
    > > def user = serverProxy.User.login(username, password)

    >
    > the method expects named parameters (as opposed to the list of values
    > you're giving). I don't know the syntax of the tool you're using, but
    > it needs to be something along the lines of
    > serverProxy.User.login(login => username, password => password). See
    > contrib/bz_webservice_demo.pl.
    >
    > Kind regards
    > Marc




  4. Re: XML-RPC User.login does not work

    Hey guys,

    What about other XML-RPC-API methods ?

    I'm having a trouble with logging in too.

    When i use User.login method, Bugzilla actually returns a user id
    properly. But that "logged in" user is not getting any permissions (as
    if he is not logged in).

    For example when i use Product.get_enterable_products, bugzilla
    returns only those products, which are only enterable for anonymous
    users and when i log in to bugzilla with the same user data - i can
    see more products that this user may enter bugs to.



    I'm coding in PHP using PEAR XML_RPC2 lib:

    //this here is ok, i get user id returned
    $userparms=array('login'=>'111@111.111','password'=>'111','remember'=>1);
    $userid = $bugzilla_conn->__call('User.login',$userparms);
    //then i want to get selectable (or enterable products), and i'm
    getting only available for anonymous user
    //and if i turn bugzilla parameter `requirelogin` on, i get a message
    "Login required".
    $productlist = $bugzilla_conn-
    >__call('Product.get_selectable_products','');




    Maybe cookies are causing a trouble? When i'm logging in using XML-
    RPC, should cookies of Bugzilla web page change (if they were set to
    other user's data) ? They are not changing now.

    Also as written in http://www.bugzilla.org/docs/tip/htm...vice/User.html,
    a http set of cookies should be returned along with a user id. I'm not
    sure if i get those cookies (i dont see those 'Set-Cookie' headers in
    server response). Should I look deeper here ?

    Am i missing something important ? Any ideas would be appreciated .

    regards, Al

    MArtin wrote:
    > Hi Marc,
    >
    > sorry for the delay.
    >
    > that works. I pass a Map as Parameter and it works fine, I can perform
    > the login.
    >
    > Thanks a lot!
    >
    > regards, MArtin
    >
    > On 25 Jun., 19:04, "Marc Schumann" wrote:
    > > MArtin,
    > >
    > > 2007/6/25, MArtin :
    > >
    > > > def user = serverProxy.User.login(username, password)

    > >
    > > the method expects named parameters (as opposed to the list of values
    > > you're giving). I don't know the syntax of the tool you're using, but
    > > it needs to be something along the lines of
    > > serverProxy.User.login(login => username, password => password). See
    > > contrib/bz_webservice_demo.pl.
    > >
    > > Kind regards
    > > Marc



  5. Re: XML-RPC User.login does not work

    The Login now works. But my XML-RPC-Framework does not support
    Cookies. So there is no way to use the Login-XMLRPC for me. The other
    way to use a URL like http://usernameassword@url.to/my/bugzilla/xmlrpc.cgi
    does not work either. I am getting again the errormessage "fault
    string = "Login Required", fault code = 410".

    As far as I can see, the XMLRPC API of Bugzilla is designed for a
    special XMLRPC-Client or it is still very experimental and not for
    usage in production environments.

    Regards, MArtin

    a.fo...@new-vision.com schrieb:
    > Hey guys,
    >
    > What about other XML-RPC-API methods ?
    >
    > (...)
    >
    > Maybe cookies are causing a trouble? When i'm logging in using XML-
    > RPC, should cookies of Bugzilla web page change (if they were set to
    > other user's data) ? They are not changing now.
    >
    > Also as written in http://www.bugzilla.org/docs/tip/htm...vice/User.html,
    > a http set of cookies should be returned along with a user id. I'm not
    > sure if i get those cookies (i dont see those 'Set-Cookie' headers in
    > server response). Should I look deeper here ?



  6. Re: XML-RPC User.login does not work

    MArtin,

    2007/7/2, MArtin :
    > way to use a URL like http://usernameassword@url.to/my/bugzilla/xmlrpc.cgi
    > does not work either. I am getting again the errormessage "fault
    > string = "Login Required", fault code = 410".


    this way of logging in is designed for HTTP authentication. Apache
    supports HTTP authentication via mod_auth* modules, and Bugzilla can
    piggyback on this using the ENV authentication method (see Bugzilla's
    user_info_class parameter). If your installation is set up like this,
    then you can use
    http://usernameassword@url.to/my/bugzilla/xmlrpc.cgi style
    authentication.

    > As far as I can see, the XMLRPC API of Bugzilla is designed for a
    > special XMLRPC-Client or it is still very experimental and not for
    > usage in production environments.


    Currently Bugzilla is locking clients not supporting cookies out,
    true. Are cookie-supporting XMLRPC clients uncommon? The only client
    I've met is Perl, so I don't really know.

    Regards
    Marc

  7. Re: XML-RPC User.login does not work

    Hi!

    Apache http authentication is really works! Bugzilla's auth_env_email
    parameter should be set to REMOTE_USER (in most cases probably) and
    user_info_class parameter should be set to ENV,CGI or just ENV. And it
    is very important that access to bugzilla MUST be secured via apache
    http authentication! If it is not secured - REMOTE_USER environment
    variable just not being created.

    Finally users got their permissions! Woohoo!

    Thank you for cooperation ;-)

    regards, Al

    Marc Schumann wrote:
    > MArtin,
    >
    > 2007/7/2, MArtin :
    > > way to use a URL like http://usernameassword@url.to/my/bugzilla/xmlrpc.cgi
    > > does not work either. I am getting again the errormessage "fault
    > > string = "Login Required", fault code = 410".

    >
    > this way of logging in is designed for HTTP authentication. Apache
    > supports HTTP authentication via mod_auth* modules, and Bugzilla can
    > piggyback on this using the ENV authentication method (see Bugzilla's
    > user_info_class parameter). If your installation is set up like this,
    > then you can use
    > http://usernameassword@url.to/my/bugzilla/xmlrpc.cgi style
    > authentication.
    >
    > > As far as I can see, the XMLRPC API of Bugzilla is designed for a
    > > special XMLRPC-Client or it is still very experimental and not for
    > > usage in production environments.

    >
    > Currently Bugzilla is locking clients not supporting cookies out,
    > true. Are cookie-supporting XMLRPC clients uncommon? The only client
    > I've met is Perl, so I don't really know.
    >
    > Regards
    > Marc



  8. Re: XML-RPC User.login does not work

    Hi All,

    I am creating a client in PHP xml-rpc,
    i am able to use User.login method,
    $result=$client->send(xmlrpc_encode_request('User.login',array('log in'=>'username','password'=>'password')));
    which returns,

    xmlrpcresp Object
    (
    [val] => id2
    [valtyp] => xml
    [errno] => 0
    [errstr] =>
    [payload] =>
    [hdrs] => Array
    (
    [date] => Mon, 06 Sep 2010 06:01:21 GMT
    [server] => Apache/2.2.3 (CentOS)
    [soapserver] => SOAP::Lite/Perl/0.710.10
    [set-cookie] => Bugzilla_login=2; path=/; expires=Fri, 01-Jan-2038 00:00:00 GMT; HttpOnly, Bugzilla_logincookie=nA48ufAaL0; path=/; expires=Fri, 01-Jan-2038 00:00:00 GMT; HttpOnly
    [content-length] => 194
    [connection] => close
    [content-type] => text/xml
    )

    [_cookies] => Array
    (
    [Bugzilla_login] => Array
    (
    [value] => 2
    [path] => /
    [expires] => Fri, 01-Jan-2038 00:00:00 GMT
    [HttpOnly] =>
    )

    [Bugzilla_logincookie] => Array
    (
    [value] => nA48ufAaL0
    [path] => /
    [expires] => Fri, 01-Jan-2038 00:00:00 GMT
    [HttpOnly] =>
    )

    )

    [content_type] => text/xml
    [raw_data] => HTTP/1.1 200 OK
    Date: Mon, 06 Sep 2010 06:01:21 GMT
    Server: Apache/2.2.3 (CentOS)
    SOAPServer: SOAP::Lite/Perl/0.710.10
    Set-Cookie: Bugzilla_login=2; path=/; expires=Fri, 01-Jan-2038 00:00:00 GMT; HttpOnly
    Set-Cookie: Bugzilla_logincookie=nA48ufAaL0; path=/; expires=Fri, 01-Jan-2038 00:00:00 GMT; HttpOnly
    Content-Length: 194
    Connection: close
    Content-Type: text/xml

    id2
    )


    But when i try to create Bug.create, it gives error 'Got xmlrpc fault 410
    Login Required',
    $result=$client->send(xmlrpc_encode_request('Bug.create',$values));
    i m passing following array to create bug,
    Array
    (
    [product] => TestProduct
    [component] => TestComponent
    [summary] => Test Summary
    [version] => unspecified
    [description] => Desc
    [op_sys] => Linux
    [platform] => PC
    [priority] => P2
    [severity] => blocker
    ),
    do i need to pass cookie along with parameters of bug?

+ Reply to Thread