# Basic Authentication within a POST-request using HTTPClient

**URL:** <https://www.ruby-forum.com/t/basic-authentication-within-a-post-request-using-httpclient/178037>\
**Category:** Rails\
**Created:** [October 28, 2009, 12:24pm UTC](https://www.ruby-forum.com/t/basic-authentication-within-a-post-request-using-httpclient/178037 "2009-10-28T12:24:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![onomato](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/958977/32.png) [@onomato](https://www.ruby-forum.com/u/onomato)\
**Post date:** [October 28, 2009, 12:24pm UTC](https://www.ruby-forum.com/t/basic-authentication-within-a-post-request-using-httpclient/178037/1 "2009-10-28T12:24:32Z")

</div>

Hey,  
I want to call a service with HTTPpost behind a BasicAuth using  
HTTPClient like this:

client = HTTPClient.new  
body = { … }  
client.set\_auth(domain, user, password)  
client.post (domain, body)

Receive a 401!  
If I try it with GET, it’s perfectly working, so I know the user/  
password is correct.

It seems, using POST, the set\_auth-method is not called.

Does anyone has an idea or solved this problem?

thx g
