[[TranslatedPages]] = OAuth Authorisation Wizard = [[PageOutline(2-10,Table of Contents)]] == OAuth in a nutshell == [http://oauth.net/ OAuth] is an open protocol to allow secure API authorisation in a simple and standard method from desktop and web applications. === Standard use case - keep your OSM password private === The standard use case in OSM is for OAuth to keep your OSM password more private than with Basic Authentication. OAuth has two major advantages over Basic Authentication: 1. Your OSM password doesn't have to be saved in clear text in the JOSM preferences file. 1. Your OSM password has to be transferred '''only once''' over the Internet on a '''secure connection''', in contrast to basic authentication where your OSM password is transferred as part of every request sent from JOSM to the OSM server in clear text. In OAuth terminology, a JOSM user authorises JOSM to access the OSM server on the user's behalf. During the authorisation process the OSM password never needs to be entered into a JOSM dialog if the user doesn't fully trust JOSM (unless wanting to for convenience reasons [wiki:/Help/Dialog/OAuthAuthorisationWizard#FullyAutomaticAuthorisation see here]). Rather, the OSM server issues an Access Token which JOSM presents to the OSM server when it uploads data on behalf of the user. Access Tokens don't reveal the user's password and they can be revoked at any time. === Advanced use case - delegate access to other mappers === A more advanced use case for OAuth is to delegate access to your OSM account to other mappers. OAuth allows you to grant another user restricted access to your account if necessary. Example: Mapper A can grant mapper B the right to download its private GPS traces from the OSM website. Mapper A would generate an OAuth Access Token and restrict it to the privilege "Download my private GPS traces". The mapper would then send an email with the Access Token to Mapper B. B can enter the Access Token in JOSM and is now allowed to download A's private GPS traces from the OSM server. B wouldn't be allowed to upload date on A's behalf, though, and doesn't know A's OSM password. At any time, A can revoke the Access Token issued to B. == The OAuth Authorisation Wizard == The Oauth authorisation wizard is located in the preferences under [Preferences/Connection Connection settings]. === What does authentication/authorisation mean? === When you upload geodata to the OSM server you have to tell the server who you are. The OSM server will '''identify''' every uploading mapper by asking for an OSM username. The OSM server furthermore needs to '''authenticate''' this identity, i.e. to reliably determine whether the mapper is indeed the claimed user. For this purpose, it asks for a password in addition to the username. The server's assumption is that whoever knows the secret password for username xyz is reliably authenticated to ''be'' xyz. A mapper logged in with an authenticated username and password is entitled to run a broad range of operations on the server. The mapper is '''authorised''' to upload data, to create changesets, to close changesets, to upload GPS traces, to read and changes personal preferences on the server, to invite others as friends, to send emails to other accounts, etc. Currently, it isn't possible to create an OSM account with an OSM username and a password with restricted rights, i.e. an account that would only be able to upload GPS traces, but not map data. Whoever has successfully '''authenticated''' with an OSM username and an OSM password is '''fully authorised''' to do everything an OSM user can normally do on the server. This is where OAuth comes into play: OAuth allows you to '''authorise''' somebody else to act in a restricted way on your behalf. Instead of giving away your OSM username and your OSM password, which would fully entitle the recipient to act on your behalf at the OSM server, you only give away a "ticket" on which the granted rights are listed. This ticket is called an '''Access Token'''. Restrictions applied to an Access Token include: * an Access Token is only valid for a specific client (called a Consumer in OAuth terminology), i.e. only for JOSM, but not for OpenStreetBugs * an Access Token is only valid for specific operations, i.e. only for uploading GPS traces, but not for uploading map data * an Access Token could only be valid for a certain time, i.e. only today, but this is not yet supported by the OSM server In addition to username/password pairs, the OSM server also accepts OAuth Access Tokens to authenticate and authorise a user. More specifically, it accepts requests ''signed with such a token'', but this is beyond of the scope of this online help. The OAuth Authorisation Wizard allows you to receive a valid OAuth Access Token, provided that you have an OSM username and OSM password, or to enter and use an OAuth Access Token in JOSM, provided that you got one from somebody else who has an OSM username and an OSM password. === Fully automatic authorisation process ===#FullyAutomaticAuthorisation The easiest way to get an Access Token is to let JOSM fully automatically retrieve one from the OSM server. 1. '''Step 1/3''' - Open the preferences dialog Click on the '''Preferences''' button in the toolbar. In the dialog, select the [wiki:Help/Preferences/Connection Connection Setting] tab. 2. '''Step 2/3''' - Get the Access Token Enter your OSM username and your OSM password and click on '''Authorise now'''. [[Image(fully-authomatic-1.png)]] 3. '''Step 3/3''' - Accept the Access Token JOSM displays the retrieved Access Token. [[Image(fully-authomatic-2.png)]] * 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. * Click on ''Test Access Token" to test the token * Click on '''Accept Access Token''' to accept it. ==== Restricting the granted privileges ==== When JOSM fully-automatically requests and authorises an Access Token, it grants it five privileges: * the right to upload data to the OSM server * the right to upload GPS traces to the OSM server * the right to download private GPS traces from the OSM server * the right to read the preferences stored on the OSM server * the right to write preferences stored on the OSM server These are the default settings. If you want to restrict the granted privileges: 1. Click the tab '''Granted rights''' 1. Deselect each privilege which should not be granted to the requested Access Token [[Image(fully-authomatic-privileges.png)]] ==== Advanced OAuth parameters ==== #FullyAutomaticAdvanced When JOSM fully-automatically requests and authorises an [https://oauth.net/core/1.0/#anchor3 Access Token], it uses default values for the OAuth parameters. Advanced users may want to change these parameters * in order to use a different Consumer Token (consisting of a Consumer Key and a Consumer Secret). This allows you to create your own Consumer Token for JOSM and then use it in JOSM. * in order to use it on a different than the standard OSM server. For instance, this allows users to use OAuth with an OSM development server or with a local installation of the OSM server application. In order to edit the Advanced OAuth parameters 1. Click the tab '''Advanced OAuth parameters''' 1. Deselect the checkbox '''Use default settings''' 1. Enter your values for the five OAuth parameters [[Image(fully-automatic-advanced.png)]] === Semi-automatic authorisation process ===#Semi-automaticauthorisationprocess You can also retrieve an Access Token semi-automatically. If you use this process you have to use both dialogs in JOSM and the OSM website launched in an external browser to create and authorise the Access Token. In contrast to the fully automatic process you never have to enter your OSM username or your OSM password into a JOSM dialog. This process is therefore suitable for a user which - for whatever reason - never wants to use their OSM password outside of the secure login page of the OSM website. The fully automatic process runs exactly the same steps that would run manually in the semi-automatic process, just without your intervention. 1. '''Step 1/3''' - Get the Request Token Click on '''Retrieve Request Token''' to retrieve an OAuth Request Token. [[Image(semi-automatic-step-1.png)]] 2. '''Step 2/3''' - Authorise the Request Token in an external browser JOSM now launches an external browser with the OSM website. Please login and follow the instructions. Then switch back to the OAuth Authorisation Wizard and click on '''Retrieve Access Token'''. [[Image(semi-automatic-step-2.png)]] 3. '''Step 3/3''' - Accept the Access Token JOSM displays the retrieved Access Token. Click on '''Accept Access Token''' to accept it. [[Image(semi-automatic-step-3.png)]] ==== Advanced OAuth parameters ==== #AdvancedOAuthparameters When JOSM semi-automatically requests and authorises an Access Token, it uses default values for the OAuth parameters. Advanced users may want to change these parameters * in order to use a different Consumer Token (consisting of a Consumer Key and a Consumer Secret). This allows you to create your own Consumer Token for JOSM and then use it in JOSM. * in order to use it on a different than the standard OSM server. For instance, this allows users to use OAuth with an OSM development server or with a local installation of the OSM server application. In order to edit the Advanced OAuth parameters 1. Select the checkbox '''Display Advanced OAuth Parameters''' 1. Enter your values for the five OAuth parameters [[Image(semi-automatic-advanced.png)]] === Manual authorisation process === The manual authorisation process allows you to enter an arbitrary Access Token. You can use this process * to enter an Access Token you have kept in a secure place, for instance in a secure store for credentials * to enter an Access Token you have received from somebody else, for instance from another mapper who granted you restricted account access 1. '''Step 1/1''' - Enter the Access Token and accept it Enter the Access Token and click on '''Accept Access Token'''. [[Image(manual.png)]] ==== Advanced OAuth parameters ==== * See [wiki:/Help/Dialog/OAuthAuthorisationWizard#FullyAutomaticAdvanced advanced preferences in the fully automatic process]. == Troubleshooting == * If you are working on a university or corporate network, a firewall may prevent the OAuth authentification request.[[BR]] Please check the corresponding connection with your network engineer. ---- Back to [wiki:/Help/Preferences/Connection Connection settings][[Br]] Back to [wiki:Help Main Help]