< OAuth
OAuth/examples
The following OAuth examples will help developers create new OpenStreetMap OAuth client software. The links give code snippets or fully working tools (with source code) in several programming languages. For more information see the general page on OAuth.
JavaScript
- iD editor uses it. See 'OAuth in javascript' blog post
- github.com/osmlab/osm-auth is the auth logic of iD ripped out to be re-usable.
- OAuth Server side Node.js examples - Explains how to safely do the OAuth process on the server side so that the keys and secrets of the consumer and user are kept secret.
Ruby
- OAuth ruby examples - code snippets in ruby
- Developing OAuth clients in Ruby - more on setting up the initial OAuth credentials
- sozialhelden/omniauth-osm - OpenStreetMap strategy for omniauth
Python
- RawEditor source code - An editor... or be it a very simple (raw) one
- OSM Fixer source code - Automated edit script
- OSM Tasking Manager source code - Web app which reads preferences via OAuth for identity
- python-social-auth - framework for authenticating
Example using requests_oauthlib:
Assuming that you collected an access token from the api, you may call the api using this access token using the library requests oauthlib, using the Oauth1 Workflow
from requests_oauthlib import OAuth1Session
client = OAuth1Session(
client_key='abcde',
client_secret='123456,
resource_owner_key=access_token['oauth_token'],
resource_owner_secret=access_token['oauth_token_secret'],
signature_type='auth_header'
)
r = client.get('https://api.openstreetmap.org/api/0.6/user/details.json')
PHP
- MapCraft (source) - php tool does basic identification (preferences read)
- Tutorial on connecting with OAuth, reading user details and sending a changeset (in Russian).
- Level0 (source) - a simple raw OpenStreetMap editor
- http://funmap.co.uk/editor/ - A super simple tag editor in a single php script by Harry Wood (bit broken, but might be useful as a starting point)
- oauth1-openstreetmap, php-league oauth1 client extended for the OSM provider
This article is issued from Openstreetmap. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.