﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
21065	Fully automatic OAuth authentication fails after change on OSM server side	jBeata	team	"The fully automatic OAuth authentication fails for JOSM with the following error:

{{{
021-07-02 11:13:03.526 java[9163:91587] 2021-07-02 11:13:03.525 SEVERE: org.openstreetmap.josm.gui.oauth.OsmOAuthAuthorizationException: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: stream is closed. Cause: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: stream is closed. Cause: java.io.IOException: stream is closed
org.openstreetmap.josm.gui.oauth.OsmOAuthAuthorizationException: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: stream is closed
	at org.openstreetmap.josm.gui.oauth.OsmOAuthAuthorizationClient.getAccessToken(OsmOAuthAuthorizationClient.java:148)
	at org.openstreetmap.josm.gui.oauth.FullyAutomaticAuthorizationUI$FullyAutomaticAuthorisationTask.realRun(FullyAutomaticAuthorizationUI.java:498)
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.doRealRun(PleaseWaitRunnable.java:94)
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.run(PleaseWaitRunnable.java:142)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: stream is closed
	at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:218)
	at oauth.signpost.AbstractOAuthProvider.retrieveAccessToken(AbstractOAuthProvider.java:108)
	at org.openstreetmap.josm.gui.oauth.OsmOAuthAuthorizationClient.getAccessToken(OsmOAuthAuthorizationClient.java:143)
	... 6 more
Caused by: java.io.IOException: stream is closed
	at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.ensureOpen(HttpURLConnection.java:3427)
	at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3452)
	at org.openstreetmap.josm.io.ProgressInputStream.read(ProgressInputStream.java:49)
	at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
	at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
	at java.io.InputStreamReader.read(InputStreamReader.java:184)
	at java.io.BufferedReader.fill(BufferedReader.java:161)
	at java.io.BufferedReader.readLine(BufferedReader.java:324)
	at java.io.BufferedReader.readLine(BufferedReader.java:389)
	at oauth.signpost.AbstractOAuthProvider.handleUnexpectedResponse(AbstractOAuthProvider.java:235)
	at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:193)
	... 8 more

2021-07-02 11:13:03.532 SEVERE: OAuth authorisation failed - <html>The automatic process for retrieving an OAuth Access Token<br>from the OSM server failed.<br><br>Please try again or choose another kind of authorisation process,<br>i.e. semi-automatic or manual authorisation.</html>
2021-07-02 11:13:03.533 java[9163:91589] 2021-07-02 11:13:03.532 SEVERE: OAuth authorisation failed - <html>The automatic process for retrieving an OAuth Access Token<br>from the OSM server failed.<br><br>Please try again or choose another kind of authorisation process,<br>i.e. semi-automatic or manual authorisation.</html>
}}}

Proposed fix from mmd: https://github.com/openstreetmap/openstreetmap-website/pull/3177#issuecomment-876154928

>''Issue is in POST /oauth/authorize''
>
>''JOSM sends hardcoded values in automated mode: &allow_write_api=yes&allow_read_prefs=yes&commit=Save+changes&allow_write_gpx=yes&allow_write_notes=yes&allow_read_gpx=yes&allow_write_prefs=yes''
>
>''Website uses: &allow_read_prefs=0&allow_read_prefs=1&allow_write_prefs=0&allow_write_prefs=1&allow_write_diary=0&allow_write_diary=1&allow_write_api=0&allow_write_api=1&allow_read_gpx=0&allow_read_gpx=1&allow_write_gpx=0&allow_write_gpx=1&allow_write_notes=0&allow_write_notes=1&''"	defect	closed	major	21.06	Core		fixed	oauth	
