Modify

Opened 7 years ago

Closed 4 years ago

Last modified 4 years ago

#7943 closed defect (fixed)

Default OAuth settings not in line with used API server

Reported by: Don-vip Owned by: team
Priority: normal Milestone: 16.02
Component: Core Version:
Keywords: OAuth Cc:

Description

I switched to master dev OSM API server (http://api06.dev.openstreetmap.org) to fix #7938 and it took me a moment to understand why I wasn't able to create a changeset.
After setting up the API server, I created a new OAuth token with the wizard, but did not see that the default advanced params are always set to:

Request Token URL: http://www.openstreetmap.org/oauth/request_token
Access Token URL: http://www.openstreetmap.org/oauth/access_token
Authorize URL: http://www.openstreetmap.org/oauth/authorize 

Two things to fix:

  • When a complete custom API server is set, the defaults settings should not be used and the user forced to enter the OAuth URLs
  • When a known dev OSM API is used (i.e. ending by dev.openstreetmap.org), the default settings should be set to
    Request Token URL: http://<name>.dev.openstreetmap.org/oauth/request_token
    Access Token URL: http://<name>.dev.openstreetmap.org/oauth/access_token
    Authorize URL: http://<name>.dev.openstreetmap.org/oauth/authorize 
    

Attachments (0)

Change History (9)

comment:1 Changed 7 years ago by Don-vip

In 5411/josm:

see #7943 - Fix OAuth rejection error message

comment:2 Changed 7 years ago by Don-vip

I am still unable to access dev API server with JOSM and OAuth but I don't understand if I'm doing something wrong or what. Has someone else ever tried ?

The only thing I am able to do is getting a weird NPE when switching back to standard API server and validating the preferences dialog:

Build-Date: 2012-08-09 21:45:10
Revision: 5411
Is-Local-Build: true

Identification: JOSM/1.5 (5411 SVN en)
Memory Usage: 156 MB / 1816 MB (55 MB allocated, but free)
Java version: 1.7.0_05, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM
Operating system: Windows 7

java.lang.NullPointerException
	at org.openstreetmap.josm.data.Preferences$AbstractSetting.toString(Preferences.java:125)
	at java.text.MessageFormat.subformat(Unknown Source)
	at java.text.MessageFormat.format(Unknown Source)
	at java.text.Format.format(Unknown Source)
	at java.text.MessageFormat.format(Unknown Source)
	at org.openstreetmap.josm.tools.I18n.tr(I18n.java:151)
	at org.openstreetmap.josm.gui.io.UploadDialog.preferenceChanged(UploadDialog.java:505)
	at org.openstreetmap.josm.data.Preferences.firePreferenceChanged(Preferences.java:237)
	at org.openstreetmap.josm.data.Preferences.put(Preferences.java:488)
	at org.openstreetmap.josm.gui.preferences.server.OsmApiUrlInputPanel.saveToPreferences(OsmApiUrlInputPanel.java:141)
	at org.openstreetmap.josm.gui.preferences.ServerAccessPreference.ok(ServerAccessPreference.java:133)
	at org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane$3.run(PreferenceTabbedPane.java:254)
	at org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane.savePreferences(PreferenceTabbedPane.java:303)
	at org.openstreetmap.josm.gui.preferences.PreferenceDialog$OKAction.actionPerformed(PreferenceDialog.java:159)
Last edited 7 years ago by Don-vip (previous) (diff)

comment:3 Changed 7 years ago by Don-vip

In 5412/josm:

see #7943 - fix NPE when switching back to default OSM API server after having tried to upload data to another server instance

comment:4 Changed 7 years ago by Don-vip

In 5422/josm:

see #7943 - Introduce OsmApi.DEFAULT_API_URL, better handling of change of API URL in OAuth management, javadoc improvements

comment:5 in reply to:  2 ; Changed 7 years ago by Don-vip

Replying to Don-vip:

I am still unable to access dev API server with JOSM and OAuth but I don't understand if I'm doing something wrong or what. Has someone else ever tried ?

No progress on this, even after the update. Could it be a problem on OSM side ?

comment:6 in reply to:  5 Changed 6 years ago by malenki

Replying to Don-vip:

Replying to Don-vip:

I am still unable to access dev API server with JOSM and OAuth but I don't understand if I'm doing something wrong or what. Has someone else ever tried ?

No progress on this, even after the update. Could it be a problem on OSM side ?

I cannot even create a oauth token (using JOSM's gui) for my user account on http://master.apis.dev.openstreetmap.org/user/malenki/
The output on bash trying to do this:

Error: org.openstreetmap.josm.gui.oauth.OsmOAuthAuthorizationException: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: Server returned HTTP response code: 500 for URL: http://api06.dev.openstreetmap.org/oauth/request_token. Ursache: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: Server returned HTTP response code: 500 for URL: http://api06.dev.openstreetmap.org/oauth/request_token. Ursache: java.io.IOException: Server returned HTTP response code: 500 for URL: http://api06.dev.openstreetmap.org/oauth/request_token. Ursache: java.io.IOException: Server returned HTTP response code: 500 for URL: http://api06.dev.openstreetmap.org/oauth/request_token
org.openstreetmap.josm.gui.oauth.OsmOAuthAuthorizationException: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: Server returned HTTP response code: 500 for URL: http://api06.dev.openstreetmap.org/oauth/request_token
	at org.openstreetmap.josm.gui.oauth.OsmOAuthAuthorizationClient.getRequestToken(OsmOAuthAuthorizationClient.java:151)
	at org.openstreetmap.josm.gui.oauth.RetrieveRequestTokenTask.realRun(RetrieveRequestTokenTask.java:80)
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.doRealRun(PleaseWaitRunnable.java:82)
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.run(PleaseWaitRunnable.java:150)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:744)
Caused by: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: Server returned HTTP response code: 500 for URL: http://api06.dev.openstreetmap.org/oauth/request_token
	at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:214)
	at oauth.signpost.AbstractOAuthProvider.retrieveRequestToken(AbstractOAuthProvider.java:69)
	at org.openstreetmap.josm.gui.oauth.OsmOAuthAuthorizationClient.getRequestToken(OsmOAuthAuthorizationClient.java:146)
	... 8 more
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://api06.dev.openstreetmap.org/oauth/request_token
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1675)
	at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1673)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1671)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1244)
	at oauth.signpost.basic.HttpURLConnectionResponseAdapter.getContent(HttpURLConnectionResponseAdapter.java:18)
	at oauth.signpost.AbstractOAuthProvider.handleUnexpectedResponse(AbstractOAuthProvider.java:228)
	at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:189)
	... 10 more
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://api06.dev.openstreetmap.org/oauth/request_token
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1626)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
	at oauth.signpost.basic.HttpURLConnectionResponseAdapter.getStatusCode(HttpURLConnectionResponseAdapter.java:22)
	at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:178)
	... 10 more

Last edited 6 years ago by malenki (previous) (diff)

comment:7 Changed 4 years ago by simon04

Milestone: 16.02

comment:8 Changed 4 years ago by simon04

Resolution: fixed
Status: newclosed

In 9355/josm:

fix #7943 - Make OAuth work for non-standard OSM APIs

You will need to obtain an application via
http://<server>/user/<user>/oauth_clients/new, and set the OAuth
consumer key+secret in the advanced OAuth parameters.

comment:9 Changed 4 years ago by simon04

In 9356/josm:

see #7943 - OAuth: Display instructions for for non-standard OSM APIs

Warning: Since you are using not the default OSM API, make sure to set
an OAuth consumer key and secret in the Advanced OAuth parameters.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.