| 52 | | [[Image(basic-authentication.png)]] |
| | 56 | ==== Authorizing JOSM ====#AuthoriseNow |
| | 57 | [[Image(oauth-2-not-authorized.png,500,link=)]] |
| | 58 | |
| | 59 | 1. Click on **Authorize now**. JOSM opens the authorization page of the OSM server in your web browser. |
| | 60 | 1. Log in, if the website asks you to, and allow JOSM to access your account. |
| | 61 | 1. Go back to JOSM and click **OK** in the preferences to save the Access Token. |
| | 62 | |
| | 63 | You don't have to do this in advance: when you upload without an Access Token, JOSM asks ''Obtain OAuth 2.0 token for authentication?'' and goes through the same steps. |
| | 64 | |
| | 65 | **Authorize now** is disabled when JOSM has no OAuth Client ID for the server; see [#AdvancedOAuthParameters Advanced OAuth parameters] below. |
| | 66 | |
| | 67 | ==== Once JOSM has an Access Token ====#AccessToken |
| | 68 | [[Image(oauth-2-authentication.2.png,500,link=)]] |
| | 69 | |
| | 70 | * Deselect the checkbox **Save to preferences** if you don't want to save the Access Token in the JOSM preferences. If you don't save it the Access Token will be lost when you close JOSM. If you later startup JOSM again you will have to retrieve a new Access Token to work with OAuth based authentication again. |
| | 71 | * Select **Use OAuth for all requests to …** to send the Access Token with downloads too, so that the server applies the limits of your account instead of those of your IP address. |
| | 72 | * Click on **New Access Token** to authorize JOSM again and replace the token, for instance after you revoked it on the website. If this fails, JOSM keeps the token it has. |
| | 73 | * Click on **Test Access Token** to submit a test request with the token to the OSM server. JOSM retrieves your user details with it: [=#AccessTokenOK] on success, it shows the user name and id the token belongs to; [=#AccessTokenFailed] otherwise it says whether the server rejected the token, or whether the server could not be reached. |
| | 74 | * Click on **Remove token** to remove the current token from JOSM. This does not revoke it on the server; do that on the website. The `Authorize now` button will reappear. The advanced OAuth parameters you entered for the server are kept. |
| | 75 | |
| | 76 | ==== Advanced OAuth parameters ====#AdvancedOAuthParameters |
| | 77 | [[Image(oauth-2-advanced.png,500,link=)]] |
| | 78 | |
| | 79 | With **Use default settings** ticked, JOSM uses the OAuth settings it has built in for the server, or which the server publishes: |
| | 80 | * The **OAuth Client ID** of the JOSM application registered on the server. JOSM has one built in for openstreetmap.org, the OSM development servers, [https://www.openhistoricalmap.org OpenHistoricalMap] and [https://opengeofiction.net OpenGeofiction]. |
| | 81 | * The **endpoints**: those the server publishes in its OAuth metadata ([https://www.rfc-editor.org/rfc/rfc8414 RFC 8414]); otherwise those of the OSM website software, which are the API URL without `/api`, followed by `/oauth2/authorize` and `/oauth2/token`. |
| | 82 | |
| | 83 | For any other server JOSM has no Client ID, so **Authorize now** stays disabled, and an upload ends with the message ''JOSM cannot obtain an OAuth Access Token for this server, because it has no OAuth Client ID for it''. Untick **Use default settings** and enter the settings of an OAuth 2.0 application registered on the server, either by you or by the server operator. On a server running the OSM website software, you can register one yourself under //My Settings > OAuth 2 applications//. Operators of a server can find what JOSM needs in [wiki:ServerOperators Using JOSM with your own OSM server]. |
| | 84 | |
| | 85 | ||= Field =||= What to enter =|| |
| | 86 | || **Client ID** || The Client ID of the OAuth 2.0 application registered on the server. || |
| | 87 | || **Client Secret** || Only needed if the application is registered as confidential. The applications JOSM has built in are public clients and have none. || |
| | 88 | || **Redirect URL** || Must be exactly the redirect URL registered with the application. JOSM receives the authorization at `http://127.0.0.1:8111/oauth_authorization`, by remote control. || |
| | 89 | || **Access Token URL** || Where JOSM gets the Access Token from: on the OSM website software, the address of the website followed by `/oauth2/token`, not the API URL. || |
| | 90 | || **Authorize URL** || Where the web browser is sent to authorize JOSM: on the OSM website software, the address of the website followed by `/oauth2/authorize`, not the API URL. || |
| | 91 | |
| | 92 | The application has to be allowed the permissions JOSM asks for: `read_gpx`, `write_gpx`, `read_prefs`, `write_prefs`, `write_api` and `write_notes`. |
| | 93 | |
| | 94 | Ticking **Use default settings** again replaces what you entered; JOSM asks before it does.[=#ResetToDefaults] |
| | 95 | |
| | 96 | ==== Using an Access Token obtained outside JOSM ====#PasteAccessToken |
| | 97 | The **Access Token** field, below the advanced OAuth parameters, shows the token JOSM has for the server. Instead of clicking **Authorize now**, you can paste a token there that you obtained in another way, and click **OK**. It needs the permissions listed above. Nothing else needs to be entered for a pasted token to work. |
| | 98 | |
| | 99 | === Basic authentication ===#BasicAuthentication |
| | 100 | ''**([wikitr:/Help/ExpertMode Expert mode] only)**'' \\ |
| | 101 | With Basic authentication, JOSM sends your user name and password with every request. openstreetmap.org and OpenGeofiction no longer accept it, so JOSM does not offer it for them. It remains for testing your own server, for instance a local installation of the OSM website software. The choice between OAuth 2.0 and Basic authentication is only shown in expert mode, or while Basic authentication is selected. |
| | 102 | |
| | 103 | Here's a screenshot of the preferences panel for basic authentication: |
| | 104 | |
| | 105 | [[Image(basic-authentication.3.png,500,link=)]] |
| 74 | | OAuth has two major advantages over basic authentication: |
| 75 | | 1. Your OSM password doesn't have to be saved in clear text in the JOSM preferences file. |
| 76 | | 2. Your OSM password has to be transferred '''only once''' over the Internet, in contrast to basic authentication where your OSM password is transferred as part of every request sent from JOSM to the OSM server. |
| 77 | | |
| 78 | | {{{ |
| 79 | | #!html |
| 80 | | <p style="background-color:rgb(253,255,221);padding: 10pt; border-color:rgb(128,128,128);border-style: solid; border-width: 1px;"> |
| 81 | | <strong>Warning!</strong><br/> |
| 82 | | Currently, the OSM server doesn't offer a secure communication channel. Even if you use OAuth your password is therefore transferred <strong>once in clear text</strong> over the Internet. <strong>Do not use a valuable password</strong> until the OSM server provides a secure communication channel (HTTPS). |
| 83 | | </p> |
| 84 | | }}} |
| 85 | | |
| 86 | | For advanced users, OAuth has additional advantages: |
| 87 | | * With OAuth you can generate restricted Access Tokens which you given somebody else such that another mapper can act on your behalf. For instance, a mapper could generate an Access Token which grants somebody else the right to download its private GPS traces. Even if he gives this Access Token to somebody else, his OSM password is kept private. In addition, he can revoke the special Access Token at any time. JOSM supports this kind of advanced configuration in the [wiki:/Help/Dialog/OAuthAuthorisationWizard OAuth Authorisation Wizard] with the authorisation procedure '''Manual authorization'''. |
| 88 | | |
| 89 | | To use OAuth based Authentication |
| 90 | | |
| 91 | | 1. In the Connection Preferences go to the tab '''Authentication''' |
| 92 | | 2. Select the authentication method '''OAuth based authentication''' |
| 93 | | 3. Click on '''Authorise now''' to launch the [wiki:/Help/Dialog/OAuthAuthorisationWizard OAuth Authorisation Wizard] (see screenshot below) |
| 94 | | |
| 95 | | [[Image(oauth-preferences-step-1.png)]] |
| 96 | | |
| 97 | | This will launch the [wiki:/Help/Dialog/OAuthAuthorisationWizard OAuth Authorisation Wizard]. Use one of the available authorization procedures in this dialog to get a valid '''Access Token'''. |
| 98 | | |
| 99 | | JOSM displays the retrieved Access Token in the preferences panel (see screenshot below): |
| 100 | | |
| 101 | | [[Image(oauth-preferences-step-2.png)]] |
| 102 | | |
| 103 | | Deselect the checkbox '''Save to preferences''' if you don't want to save the Access Token in the JOSM preferences. If you don't save it the Access Token will be lost when you close JOSM. If you later startup JOSM again you will have to retrieve a new Access Token to work with OAuth based authentication again. |
| 104 | | |
| 105 | | Click on '''Test Access Token''' to submit a test request with the token to the OSM server. JOSM will analyse whether this token is authorized to access the OSM server. |
| 106 | | |
| 107 | | Click on '''New Access Token''' to generate a new Access Token. |
| 108 | | |
| 109 | | ==== Advanced OAuth parameters ==== |
| 110 | | Select the checkbox '''Display Advanced OAuth parameters''' to display the important OAuth parameters |
| 111 | | * the [http://oauth.net/core/1.0/#anchor3 Consumer Key] and the [http://oauth.net/core/1.0/#anchor3 Consumer Secret] identifying JOSM as OAuth consumer |
| 112 | | * the Request Token URL where JOSM can retrieve [http://oauth.net/core/1.0/#anchor3 Request Tokens] |
| 113 | | * the Access Token URL where JOSM can retrieve [http://oauth.net/core/1.0/#anchor3 Access Tokens] |
| 114 | | * the Authorise URL where JOSM users are redirected to to authorise a Request Token |
| 115 | | |
| 116 | | [[Image(oauth-advanced.png)]] |
| 117 | | |
| 118 | | == Proxy Settings == #ProxySettings |
| 119 | | JOSM communicates with the OSM server using the Hypertext Transfer Protocol ([http://en.wikipedia.org/wiki/Http HTTP]). If required it can relay its requests through a [http://en.wikipedia.org/wiki/Http_proxy HTTP proxy] or a [http://en.wikipedia.org/wiki/SOCKS SOCKS proxy]. |
| 120 | | |
| 121 | | 1. Go to the tab '''Proxy settings''' in the Connection Preferences |
| 122 | | 2. Select one of the available options and enter additional configuration parameters |
| 123 | | 3. Save the preferences |
| 124 | | |
| 125 | | [[Image(proxy-settings.png)]] |
| | 120 | === Max age of closed OSM Notes ===#OSMNotes |
| | 121 | The maximum age in days of closed [wikitr:/Help/Dialog/Notes OSM Notes] can be set (''advanced preference'': `osm.notes.daysClosed`). The default value is `7` days. See [wikitr:/Help/Dialog/Notes#AdvancedPreferences Advanced preferences for notes] for details. |