B2B Integration

 View Only
  • 1.  Basic Auth in HTTP connection keeps getting 401 unauthorized from B2Bi 6.0.1

    Posted Tue April 27, 2021 12:09 AM
    Hello All,

    We have an issue here where we need to do a http post to an endpoint using basic auth. Now when we are trying to do the post using Postman with the same credentials and body, we get a 200 ok response .

    But the same credentials when passed in http connection in the Authorization header as below, we keep getting 401 unauthorized server response. When checked with the destination side, they can see a different string on the auth header than what we are sending from our side in the mime document and hence we keep getting 401 error.

    See below -

    in B2Bi -

    Authorization: Basic czMxNjBlZGkzcG9kQGtyb2dlci5jb206SnZKY3RCdExvQUZiNklxRm5rNm9CSHk=
     followed by body

    In destination -

    Authorization: Basic czMxNjBlZGkzcG9kQEtyb2dlci5jb206QUFBQU9RQUFBRVVBQUFCN0FBQUFWUUFBQUVRQUFBQW5BQUFBRUFBQUFDVUFBQUJjQUFBQU1RQUFBQ2tBQUFBR0FBQUFSUUFBQUhvQUFBQkFBQUFBY0FBQUFGNEFBQUFPQUFBQVVnQUFBQVlBQUFCeEFBQUFPQUFBQUJZPQ


    What could be the issue here ?


    ------------------------------
    Pranjit Biswas
    ------------------------------

    #B2BIntegration
    #SupplyChain


  • 2.  RE: Basic Auth in HTTP connection keeps getting 401 unauthorized from B2Bi 6.0.1

    Posted Wed April 28, 2021 03:37 AM
    Hi Pranjit,

    When I decoded your Basic Auth String I got username as email id however after colomn I found an base64 encoded password. It seems the password which you are supplying is already encoded. First put username and password in this format, <username>:<password>, then base64 encode and then prefix Basic<space>.

    Which adapter you are using RestAPIClientAdapter or HTTP Client Adapter?

    Regards,
    Bharat

    ------------------------------
    BHARAT BALOTHIA
    ------------------------------



  • 3.  RE: Basic Auth in HTTP connection keeps getting 401 unauthorized from B2Bi 6.0.1

    Posted Wed April 28, 2021 03:48 AM
    Hi Bharat,

    Here are few more inputs on the queries -

    1. We are adding that encoded string as hardcode in the mime service . The userid does have a domain name (@XXXX.com)
    2. We are using httpclient adapter
    3.We are unobscuring it before passing the password from the obscureresults to http begin session service as a parm.

    Let me know if adding a code snippet would help troubleshoot this and I can do so without revealing any client details.

    ------------------------------
    Pranjit Biswas
    ------------------------------



  • 4.  RE: Basic Auth in HTTP connection keeps getting 401 unauthorized from B2Bi 6.0.1

    Posted Wed April 28, 2021 03:42 AM
    By the way, is the password already obscured by B2Bi?

    ------------------------------
    BHARAT BALOTHIA
    ------------------------------



  • 5.  RE: Basic Auth in HTTP connection keeps getting 401 unauthorized from B2Bi 6.0.1

    Posted Wed April 28, 2021 06:00 AM
    Thank you Bharat. I was able to follow your instructions and issue has been fixed..

    ------------------------------
    Pranjit Biswas
    ------------------------------



  • 6.  RE: Basic Auth in HTTP connection keeps getting 401 unauthorized from B2Bi 6.0.1

    Posted Wed April 28, 2021 07:47 AM
    Hello, eu ja tive esse problema, porem no meu caso era JWT que não era validado no client.  Usei o stripDefaultPortFromRequestHostHeader=true. 
    Mas acho que o seu caso é diferente. Voce pode compartilhar seu BP ?


    ------------------------------
    Fabio Aurelio Maciel Lima e Silva
    ------------------------------