HTTPS POST with basic authentication

Discussion in 'Ruby' started by Piyush Ranjan, Sep 12, 2008.

  1. [Note: parts of this message were removed to make it a legal post.]

    Hi
    I need to do a https POST with basic authentication to query a service. I am
    unable to find this in api or any of the blog entries I am seen so far. Is
    it possible to do this ?
     
    Piyush Ranjan, Sep 12, 2008
    #1
    1. Advertising

  2. Piyush Ranjan

    Guest

    Have you tried including your username and password in the url when
    you create your uri for the POST request?

    For example, http://foo:, where foo is your username
    and bar is your password.

    On 9/12/08, Piyush Ranjan <> wrote:
    > Hi
    > I need to do a https POST with basic authentication to query a service. I am
    > unable to find this in api or any of the blog entries I am seen so far. Is
    > it possible to do this ?
    >
     
    , Sep 12, 2008
    #2
    1. Advertising

  3. Piyush Ranjan

    Bill Kelly Guest

    From: "Piyush Ranjan" <>
    >
    > I need to do a https POST with basic authentication to query a service. I am
    > unable to find this in api or any of the blog entries I am seen so far. Is
    > it possible to do this ?



    require 'base64' # NOTE: the name of this module may be different

    headers = {}
    headers['Authorization'] = 'Basic ' + encode64("#{user}:#{pass}").chop
    resp = http.post(path, body, headers)


    Hope this helps,

    Bill
     
    Bill Kelly, Sep 12, 2008
    #3
  4. [Note: parts of this message were removed to make it a legal post.]

    thanks bill
    this is exactly what I implemented

    Piyush

    On Sat, Sep 13, 2008 at 1:47 AM, Bill Kelly <> wrote:

    >
    > From: "Piyush Ranjan" <>
    >
    >>
    >> I need to do a https POST with basic authentication to query a service. I
    >> am
    >> unable to find this in api or any of the blog entries I am seen so far. Is
    >> it possible to do this ?
    >>

    >
    >
    > require 'base64' # NOTE: the name of this module may be different
    >
    > headers = {}
    > headers['Authorization'] = 'Basic ' + encode64("#{user}:#{pass}").chop
    > resp = http.post(path, body, headers)
    >
    >
    > Hope this helps,
    >
    > Bill
    >
    >
    >
    >
     
    Piyush Ranjan, Sep 12, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brett Porter
    Replies:
    2
    Views:
    808
    Andrea D'Onofrio [MSFT]
    Jan 20, 2004
  2. Mark
    Replies:
    0
    Views:
    707
  3. Axel
    Replies:
    8
    Views:
    1,282
    Adrienne Boswell
    Apr 27, 2009
  4. jotto
    Replies:
    4
    Views:
    446
    jotto
    Oct 2, 2006
  5. Naveen Dhanuka
    Replies:
    1
    Views:
    321
Loading...

Share This Page