create new app ( osm.org/oauth2/applications/new )
set callback url ( must be https if not 127.0.0.1 )
client id and secret will be presented ( secret only once )
to obtain authorization code from browser go to
https://www.openstreetmap.org/oauth2/authorize?client_id=<Client ID>&response_type=code&redirect_uri=<Callback url encoded>&scope=write_api%20read_prefs%20write_notes
when user authorize access callback will be called like
https://localhost:7077/oauth2/callback?code=<Authorization Code>
exchange Authorization Code for access token, POST
curl -d "" 'https://www.openstreetmap.org/oauth2/token?grant_type=authorization_code&code=<Authorization Code>&client_id=<Client ID>&redirect_uri=<Callback url encoded>&client_secret=<Client Secret>'
access token will be returned as json, use it for API calls
curl -H "Authorization: Bearer <Access token>" 'https://api.openstreetmap.org/api/0.6/user/details'
resources to read:
https://aaronparecki.com/oauth-2-simplified/
osm.wiki/OAuth