401 Authorization error

79 views
Skip to first unread message

Raghuveer Mudiraj

unread,
May 20, 2021, 1:00:34 PM5/20/21
to Review Board Community
Hi,

I have done the LDAP settings on our reviewboard server. However, when I am trying to login to the reviewboard server using the below code, it is throwing the below error:

DEBUG: CM::RBDBI::__RBinit__: HASH(0x2a5aae0)
DEBUG: CM::RBDBI::__RBinit__: HTTP::Headers=HASH(0x2b9f0f0)
DEBUG: CM::RB::RBGet: URL=https://<reviewboard server>:443/api
DEBUG: CM::RB::RBGet: Header=HTTP::Headers=HASH(0x2b9f0f0)
DEBUG: CM::RB::RBGet: Response=HTTP::Response=HASH(0x332c288)
DEBUG: CM::RB::RBprocess: status = 200 OK
DEBUG: CM::RBDBI::ConnectToRBServer: Connected to Review Board Server using url https://<reviewboard server>:443/api
DEBUG: CM::RBDBI::__RBinit__: HASH(0x2a5aae0)
DEBUG: CM::RBDBI::__RBinit__: HTTP::Headers=HASH(0x2b72340)
DEBUG: CM::RB::RBGet: URL=https://<reviewboard server>:443/api/review-requests/58656
DEBUG: CM::RB::RBGet: Header=HTTP::Headers=HASH(0x2b72340)
DEBUG: CM::RB::RBGet: Response=HTTP::Response=HASH(0x3331b38)
DEBUG: CM::RB::RBprocess: status = 401 UNAUTHORIZED
<br>Bad response while posting data (401 UNAUTHORIZED)
<br>Message = UNAUTHORIZED
DEBUG: main::checkChangeIDStatus: All changes
DEBUG: CM::RBDBI::GetRBFieldValueUsingURL: The URL = https://<reviewboard server>:443/api/review-requests/58656
DEBUG: CM::RBDBI::GetRBFieldValueUsingURL: The Header is = HTTP::Headers=HASH(0x2b72340)
DEBUG: CM::RB::RBGet: URL=https://<reviewboard server>:443/api/review-requests/58656
DEBUG: CM::RB::RBGet: Header=HTTP::Headers=HASH(0x2b72340)
DEBUG: CM::RB::RBGet: Response=HTTP::Response=HASH(0x35752a0)
DEBUG: CM::RB::RBprocess: status = 401 UNAUTHORIZED
<br>Bad response while posting data (401 UNAUTHORIZED)
<br>Message = UNAUTHORIZED

this is failing due to login as anonymous account. Even if I try to give the LDAP account credentials this is treating as anonymouse account. Do we have any perl code which login the reviewboard server api using LDAP credentials?

Christian Hammond

unread,
May 20, 2021, 11:26:30 PM5/20/21
to revie...@googlegroups.com
Hi,

I wasn't even aware of any Perl bindings that talk to Review Board in the first place. Is this something that's in-house?

I'm not entirely sure from the log output what the failure is. It looks to be failing to authenticate via the API, but whether this is bad credentials/API token being passed in the Authorization header in the request, or a communication error with LDAP, I can't say from the output.

Can you give me more information on what's being sent and how you're forming the request?

Can you verify that the request is sending an Authorization: header in a request, and what form of authentication the client is using for this?

Christian

--
Supercharge your Review Board with Power Pack: https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
---
You received this message because you are subscribed to the Google Groups "Review Board Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reviewboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/reviewboard/e7f8f283-8981-4601-ba4f-653f24f11974n%40googlegroups.com.


--
Christian Hammond
President/CEO of Beanbag
Makers of Review Board

Raghuveer Mudiraj

unread,
May 21, 2021, 12:42:41 AM5/21/21
to Review Board Community
Hi Christian,

thanks for quick response.

We are using the below perl modules for the LDAP login.

use HTTP::Request;
use LWP;
use HTTP::Request::Common;
use HTTP::Cookies;

LWP::UserAgent

We are passing the credentials to authenticate via API. However, while logging it is throwing "401 Authorization error". This is due to the ldap settings which is not allowing anonymous users. 

However, I tried to set the checkbox which will allow the anonymous users to read the review requests. But it will not allow to write anything to RB.

Please see the below header.

    $RBUSER=getRBProfile('User');
    $RBPASSWD=decode_base64(getRBProfile('Pwd'));
    $header = HTTP::Headers->new;
    $header->header(Authorization => "Basic ".encode_base64("$RBUSER:$RBPASSWD", ""));
    $header->header('Content-Type' => "application/xml; charset=UTF-8");
    $header->header(Accept => "application/xml");
    $header->header('http.protocol.single-cookie-header' => "true");

Let me know if you need anymore information.

Christian Hammond

unread,
May 21, 2021, 4:39:01 AM5/21/21
to revie...@googlegroups.com
Can you try creating an API token for the user (available in My Account) and using that as the password? That’s generally better for scripts anyway, but I want to just verify that the general authentication path that’s posing problems.

Christian


--

Raghuveer Mudiraj

unread,
May 21, 2021, 4:43:30 AM5/21/21
to Review Board Community
Currently i am using ReviewBoard 1.7.9. Does it have any other option to create API token? If not, can we create the through command line?

Raghuveer Mudiraj

unread,
May 21, 2021, 10:51:42 AM5/21/21
to Review Board Community
FYI, using curl command I am not able to login.

curl -k --user <username> https://<server name>/api/users/ -H "Accept: application/json"
Enter host password for user '<username>':
{"stat": "fail", "err": {"msg": "You are not logged in", "code": 103}

What could be the issue? How test if the url is working with respect to user authentication?

Christian Hammond

unread,
May 22, 2021, 3:30:15 PM5/22/21
to revie...@googlegroups.com
I’m afraid 1.7.x is completely unsupported, and won’t receive any fixes of any sort, as it’s 8 years old and is 4 major versions behind. Can you upgrade?

Christian


Reply all
Reply to author
Forward
0 new messages