appdotnet / api-spec

App.net API Documentation is on the web at https://developers.app.net. Source for these docs is in the new-docs branch here. Please use the issue tracker and submit pull requests! Help us build the real-time social service where users and developers come first, not advertisers.
https://developers.app.net
950 stars 98 forks source link

500 status code when requesting access token #231

Closed allonhadaya closed 12 years ago

allonhadaya commented 12 years ago

I'm trying to get an access token using the server-side authentication flow.

I successfully authorized my app on a testing account, but I'm running into trouble trying to get the access token.

My request looks like this:

uri: https://alpha.app.net/oauth/access_token
method: POST
content_type: multipart/form-data
body: code=[code from first step]&client_id=[my client id]&client_secret=[my client secret]&grant_type=authorization_code&redirect_uri=[my callback uri]

app.net is sending me back a 500 with the standard rendered error message.

What's going on?

allonhadaya commented 12 years ago

Ok, I figured it out.

I had to change my content-type from multipart/form-data to application/x-www-form-urlencoded.

For Improvement

  1. Make it clearer that the api expects application/x-www-form-urlencoded
  2. Give back a 400 instead of a 500 so that developers know there's a problem with their request