OAuth/examples

From OpenStreetMap Wiki
Jump to navigation Jump to search

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

Ruby

Python


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