[OSM-dev] OAuth 401 Unauthorized
gravitystorm at gmail.com
Fri May 28 11:40:12 BST 2010
On Fri, May 28, 2010 at 11:02 AM, Christoph Bünte
<tiny-grasshopper at gmx.net> wrote:
> Hi there,
> I just started developing an osm client website. I Already registered this app with my osm account and got key and secret. When I try to create a request_token, the osm oauth service always returns a HTTP status code 401 Unauthorized. Is there anything wrong with my key and secret? Does it take a while to be activated?
They are activated instantly, so they should be working straight away.
> This is my piece of ruby code, which is closely related to the OAuth example: http://wiki.openstreetmap.org/wiki/OAuth/Examples
I've updated the examples since the exact behaviour of the OAuth
plugin seems to have changed slightly over the last 12 months.
> consumer = OAuth::Consumer.new(oauth_key, oauth_secret, :site => 'http://www.openstreetmap.org')
Please don't test your application with the live API! There are test
APIs available on the development server, and for this you should be
using http://api06.dev.openstreetmap.org, with a separate account,
oauth token etc for that.
> But the second line always failes with an exception. I have installed the oauth gem version 0.4.0
> Are there any known issues?
> I appreciate any kind of help, links and whatsoever. I wasn't able to find something on the net specific to OSM.
The only thing I can think of is that you're mixing up tokens issued
from a development server against the real server, or there's a typo
in your commands.
If nothing else works, please start with the example as written on the
wiki, get that working with a test account on api06.dev, and start
modifiying from there. Post the whole code when you make the change
that breaks it.
More information about the dev