OAuth

From OpenStreetMap Wiki
(Redirected from Oauth)
Jump to: navigation, search
OAuthLogo.png
OAuth on OpenStreetMap is a mechanism which allows users to authorise third party applications to do things with their OSM user account - without that application handling the user's password. The User Credentials Policy recommends application developers should use OAuth in preference to HTTP Basic Auth or other methods for access to the API.

Contents

Usage for developers

You can register your Consumer application on your OpenStreetMap user page via the View my OAuth details link on the bottom of the page.

Here are the relevant URLs for reference:

For development and testing purposes, the API instance on the dev server also has OAuth endpoints. Their URLs are:

A few more details:

The basic idea

An application, for example JOSM, or a website, for example OpenCycleMap could receive permission to make edits to OpenStreetMap data with the user's account.

OAuth is used by some other sites such as twitter and flickr. If you use a flickr uploader app for example, you can see how the authorisation would work from a user perspective. When you try to use the app, it needs to direct the user to the website, where you log in as usual, and then grant permissions. The app then receives a token which it can use in its requests. It eliminates the need for the app to know about the users login credentials. Nifty.

Development

Oauth is live on production.

See OAuth examples for code snippets and links to working tools' source code in various languages, to help you create OpenStreetMap OAuth clients.

Registering your application as OAuth consumer

Before an application can use the OAuth protocol to gain authorized access to the protected resources on the OSM server it has to be registered as OAuth consumer. Every registered user can register applications as consumer.

  1. Login to your account
  2. Scroll to the bottom of your preferences page
  3. Click on View my OAuth details
  4. Click on Register your application

In the following form you have to enter four parameters:

Basics of the protocol

  1. you register your application (consumer) and supply CONSUMER_KEY + CONSUMER_SECRET into it
  2. some user runs your application, it calls Request Token URL and recieves: oauth_token + oauth_token_secret
  3. then it redirects the user to Authorize URL + '?oauth_token=' + oauth_token
  4. user logs in on OpenStretMap.org, the site asks him to grant permissions
  5. if callback url is supllied during registration, user is redirected to Callback URL + '?oauth_token=' + the_same_oauth_token
  6. your application gets the same oauth_token, calls Access Token URL and recieves: oauth_token + oauth_token_secret
  7. these are used for further communication

Extra notes

External Resources

Personal tools
Namespaces
Variants
Actions
site
Toolbox