Search:
Login
Preferences
Help/Guide
About Trac
Register
Forgot your password?
Wiki
Timeline
Changelog
Browse Source
View Tickets
New Ticket
Roadmap
Builds
Sonar
Search
Context Navigation
+0
Start Page
Index
History
Editing ServerOperators
Adjust edit area height:
8
12
16
20
24
28
32
36
40
Edit side-by-side
[[TranslatedPages]] = Using JOSM with your own OSM server = [[PageOutline(2-3,Table of Contents)]] This page is for people who run a server with the OSM website software, [https://github.com/openstreetmap/openstreetmap-website openstreetmap-website], other than openstreetmap.org: a project of its own, a regional or test instance, or a development installation. It says what JOSM needs to download from, and upload to, such a server. For the settings a JOSM user makes, see [wikitr:/Help/Preferences/Connection Preferences > OSM Server]. == In short == 1. Serve the OAuth metadata at `/.well-known/oauth-authorization-server` on the host of your API URL. 1. Register an OAuth 2.0 application for JOSM: public (not confidential), with the redirect URL `http://127.0.0.1:8111/oauth_authorization` and the permissions `read_gpx`, `write_gpx`, `read_prefs`, `write_prefs`, `write_api` and `write_notes`. 1. Give your users its Client ID, or ask for it to be built into JOSM. == Authentication == JOSM authenticates with [https://oauth.net/2 OAuth 2.0]: the user authorizes JOSM in the web browser, on your website, and JOSM receives an Access Token for the server. The authorization uses PKCE, so a public client works without a client secret. Basic authentication, with user name and password, is also available in JOSM, in expert mode, as a quick way to test a server; it is not offered for openstreetmap.org and OpenGeofiction, which do not accept it. It is not meant for a server with users of its own. JOSM keeps its OAuth settings and the Access Token per server, by the host name of the API URL. === OAuth metadata (RFC 8414) ===#Metadata JOSM looks up the endpoints of the server in its OAuth 2.0 authorization server metadata ([https://www.rfc-editor.org/rfc/rfc8414 RFC 8414]), at {{{ <scheme>://<host>[:<port>]/.well-known/oauth-authorization-server }}} where scheme, host and port are those of the **API URL**. openstreetmap-website answers this request itself, for instance: {{{ https://www.openstreetmap.org/.well-known/oauth-authorization-server }}} JOSM reads `authorization_endpoint` and `token_endpoint` from it. If the API is served from a host other than the website, the API host has to answer this request too, directly or with a redirect to the website, as `api.openstreetmap.org` does. If JOSM gets no metadata, it falls back to the endpoints of openstreetmap-website, below the address of the website, which is taken to be the API URL without the trailing `/api`: {{{ <website>/oauth2/authorize <website>/oauth2/token }}} So a server whose API URL is `https://example.org/api` works with JOSM's defaults even without the metadata. Users can enter different endpoints in the advanced OAuth parameters, but each user would have to. === The OAuth 2.0 application for JOSM ===#Application A Client ID is needed in any case: the metadata does not provide one. Register an application for JOSM on your server, on openstreetmap-website under //My Settings > OAuth 2 applications//, with: ||= Setting =||= Value =|| || Name || JOSM || || Confidential application || No. JOSM is a desktop application and cannot keep a secret; it uses PKCE instead. || || Redirect URIs || `http://127.0.0.1:8111/oauth_authorization` — JOSM receives the authorization by [wikitr:/Help/Preferences/RemoteControl Remote Control] on this address. || || Permissions || `read_prefs`, `write_prefs`, `write_api`, `read_gpx`, `write_gpx` and `write_notes` || JOSM asks for all six permissions when it authorizes. An application allowed fewer is rejected by the server when JOSM authorizes; a token issued with fewer permissions and pasted into JOSM works only for what it allows. Then either: * **publish the Client ID** for your users, who untick ''Use default settings'' in [wikitr:/Help/Preferences/Connection#AdvancedOAuthParameters Preferences > OSM Server] and enter it in the field **Client ID**; or * **ask for it to be built into JOSM**, so that ''Authorize now'' works for your server without any setting: [/newticket open a ticket] with the API URL of your server and the Client ID of an application registered as above. JOSM has built-in Client IDs for openstreetmap.org, the OSM development servers, OpenHistoricalMap and OpenGeofiction. Without a Client ID, JOSM does not send the user to the browser, but says that it has no OAuth Client ID for the server and offers to open the preferences. === Tokens obtained outside JOSM === A user can also paste an Access Token obtained in another way into the field **Access Token** of the OSM Server preferences; nothing else needs to be set for it to work. JOSM sends it as a bearer token. == Checking the setup == 1. In JOSM, enter your API URL in [wikitr:/Help/Preferences/Connection Preferences > OSM Server] and click **Validate**. 1. Untick ''Use default settings'' if JOSM has no built-in Client ID for your server, and enter it; the endpoints should already show those of your server. 1. Click **Authorize now**, authorize JOSM in the browser, then click **Test Access Token**: it should show your user name. 1. If authorization fails, start JOSM with `--debug`: the log shows the requests JOSM makes, with credentials stripped (since r19711). ---- Back to [wikitr:/Help/Preferences/Connection Preferences > OSM Server] \\ Back to [wikitr:/Help Main Help]
Note:
See
WikiFormatting
and
TracWiki
for help on editing wiki content.
Change information
Your email or username:
E-mail address and name can be saved in the
Preferences
Comment about this change (optional):
Note:
See
TracWiki
for help on using the wiki.