← Back to team overview

launchpad-dev team mailing list archive

Re: Problem using Launchpad API to retrieve the authenticated user

 

Hi William,

Thanks a lot for your reply. My request (I've revoked the OAuth
credentials) is

Header data: {
    Accept = "application/json";
    "Accept-Encoding" = "gzip, deflate";
    "Accept-Language" = "en-us";
    Authorization = "OAuth realm=\"https://api.launchpad.net/\
",oauth_consumer_key=\"Chris-Wilson-App-Key\",oauth_token=\"5CxXHrFKqn1fWsWMKXXH\",oauth_signature_method=\"PLAINTEXT\",oauth_signature=\"%26BVjq9NlhL1rH8FW8Fg1LM3kNskcQxFFhlh3pM5X6JXjcT8CJhNtJp5PGqVF6TZS3VKdNLqPk8NnmtZbz\",oauth_timestamp=\"1363127374\",oauth_nonce=\"xOUnK7gEirDkNuYE7hepGnaV24r6xTfp\",oauth_version=\"1.0\"";
    "Content-Type" = "application/json";
}


On 12 March 2013 23:01, William Grant <william.grant@xxxxxxxxxxxxx> wrote:

> On 13/03/13 09:22, Chris Wilson wrote:
> > Hi there,
> >
> > I'm attempting to build a Launchpad client and have run into a problem
> > sending a signed OAuth request to retrieve the authenticated user.
> >
> > Every time I send a GET request
> > to https://api.staging.launchpad.net/people/+me I get a 401 Unauthorised
> > response before the redirect can happen.
> >
> > I would have thought there was a problem with my OAuth tokens if,
> > whenever I send the exact same request
> > to http://www.launchpad.net/people/+me, I didn't get the full HTML page
> > for the authenticated user back.
>
> Only api.(qastaging.|staging.)launchpad.net accept OAuth; the webapp
> does not. You're probably accidentally authenticating with a cookie instead
>
> > Does this description give anyone any idea what's wrong with my code, or
> > would you need to see more of it before knowing for sure?
>
> I suspect you haven't signed the request properly, as that works fine in
> launchpadlib:
>
> In [2]: lp.load('/people/+me')
> Out[2]: <person at https://api.launchpad.net/devel/~wgrant>
>
> What does your request look like (redacting the sensitive OAuth tokens)?
>
>

Follow ups

References