0

I am attempting to use the /me API to retrieve an authenticated user's details but I am receiving a 400 error.

I am able to complete the OAuth2 dance and have been able to capture the access token and expire value, but when I then go on to send my request to https://api.stackexchange.com/2.0/me?site=stackoverflow (including access token) it gives me a 400 error.

Here is what I am logging if it's of any use:

GET request for "https://api.stackexchange.com/2.0/me?site=stackoverflow" resulted in 400 (Bad Request); invoking error handler
HttpClientErrorException while completing connection: 400 Bad Request
Response body: ?

Is there anything I am missing? other than just sending the access token to the above URL is there anything else I need to do?

1 Answer 1

2

You need to pass your request key as well.

I'm not sure what you're using that isn't giving you the error message back, but if you had captured it you would have seen it said something like:

{
  "error_id":405,
  "error_name":"key_required","
  error_message":"`key` is required when `access_token` is passed."
}
4
  • Thanks - I thought that the key was only required in cases where the access token is not being passed - the only thing I can find in the docs about is this: "Pass this as key when making requests against the Stack Exchange API to receive a higher request quota." Is there any documentation detailing that it is required?
    – rhinds
    Commented Mar 26, 2012 at 10:36
  • @rhinds - looks like a documentation oversight, I'll get it fixed in the next deploy. Commented Mar 26, 2012 at 17:13
  • Great thanks - am going to try including my key in the request.
    – rhinds
    Commented Mar 26, 2012 at 17:35
  • Hi @Kevin Montrose, I have just come back to this project (having been working on other things) - I have now updated my request to include the key (now hitting: api.stackexchange.com/2.0/me?site=stackoverflow&key=XXXXXXX) and including the access_token, but I am still getting the same "resulted in 400 (Bad Request)" Error - any other ideas or suggestions?
    – rhinds
    Commented May 19, 2012 at 21:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .