Modify

Opened 9 months ago

Closed 4 months ago

#23538 closed defect (needinfo)

Some 'OAuth 2' access tokens work, while others do not

Reported by: Rub21 Owned by: Rub21
Priority: normal Milestone:
Component: Core Version:
Keywords: OAuth2 access token Cc:

Description

Currently, I am working on integrating OHM-staging API with JOSM using OAuth2. The API is https://staging.openhistoricalmap.org/api For some reason, some "OAuth 2 applications" do not work; they throw an error. Luckily, I found one that works. It could be assumed that it's a problem with the OHM-API. However, when I changed "OAuth 2" to "OSM-API" in JOSM, it throws the same error as in the OHM-staging API. Here is the reference: https://github.com/OpenHistoricalMap/issues/issues/610#issuecomment-1979859527

Create a "OAuth 2 applications", in OSM-API

  • Permissions

Read user preferences (read_prefs)
Modify user preferences (write_prefs)
Create diary entries, comments and make friends (write_diary)
Modify the map (write_api)
Read private GPS traces (read_gpx)
Upload GPS traces (write_gpx)
Modify notes (write_notes)

  • Redirect URIs

http://127.0.0.1:8111/oauth_authorization


Lets use the token created in JOSM config for authorization

What steps will reproduce the problem?

  • Download latest JOSM Latest
  • preferences / OSM Server / Display Advanced OAuth Parameters (do not activate the button to get thetoken)
  • preferences / OSM Server / Authorize now (Manual)/Advanced OAuth Parameters (do not activate the button Test Access token)

Since I couldn't test the token directly in the JOSM UI, I hardcoded the token.

  • Run JOSM and test the authorization.

https://github.com/OpenHistoricalMap/issues/assets/1152236/cfe883bd-a3f8-4dac-b745-d0482307750a

`

Revision:19015
Is-Local-Build:true
Build-Date:2024-03-08 08:53:19

Identification: JOSM/1.5 (19015 SVN en) Mac OS X 13.0
OS Build number: macOS 13.0 (22A8380)
Memory Usage: 396 MB / 4096 MB (182 MB allocated, but free)
Java version: 17.0.9+8-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM
Look and Feel: com.apple.laf.AquaLookAndFeel
Screen: Display 1 1512×982 (scaling 2.00×2.00) Display 2 1920×1080 (scaling 1.00×1.00) Display 3 1920×1080 (scaling 1.00×1.00)
Maximum Screen Size: 1920×1080
Best cursor sizes: 16×16→16×16, 32×32→32×32
Environment variable LANG: en_US.UTF-8
System property file.encoding: UTF-8
System property sun.jnu.encoding: UTF-8
Locale info: en_US
Numbers with default locale: 1234567890 -> 1234567890

Plugins:
+ FastDraw
+ apache-commons
+ buildings_tools
+ continuosDownload
+ ejml
+ geotools
+ jackson
+ jaxb
+ josm_magic_wand
+ jts
+ opendata
+ osm-obj-info
+ scripting
+ utilsplugin2

Map paint styles:
+ https://gist.githubusercontent.com/karitotp/728f688f2df8a30d449cd7189f92c80c/raw/4c3833b84c05749ec7a25e70a59d24c758fa2ea5/reforestamos_mexico.mapcss

Last errors/warnings:
- 00091.210 E: 	at java.desktop/java.awt.Container.add(Container.java:1001)
- 00091.210 E: 	at java.desktop/javax.swing.JOptionPane.initDialog(JOptionPane.java:987)
- 00091.210 E: 	at java.desktop/javax.swing.JOptionPane.createDialog(JOptionPane.java:978)
- 00091.210 E: 	at java.desktop/javax.swing.JOptionPane.showOptionDialog(JOptionPane.java:877)
- 00091.210 E: 	at org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.checkPermission(RequestHandler.java:213)
- 00091.210 E: 	at org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.handle(RequestHandler.java:86)
- 00091.210 E: 	at org.openstreetmap.josm.io.remotecontrol.RequestProcessor.run(RequestProcessor.java:266)
- 00154.522 E: Handled by bug report queue: jakarta.json.stream.JsonParsingException: Invalid token=EOF at (line no=1, column no=0, offset=-1). Expected tokens are: [CURLYOPEN, SQUAREOPEN, STRING, NUMBER, TRUE, FALSE, NULL]
- 00160.295 E: Handled by bug report queue: jakarta.json.stream.JsonParsingException: Invalid token=EOF at (line no=1, column no=0, offset=-1). Expected tokens are: [CURLYOPEN, SQUAREOPEN, STRING, NUMBER, TRUE, FALSE, NULL]
- 00251.808 E: Handled by bug report queue: jakarta.json.stream.JsonParsingException: Invalid token=EOF at (line no=1, column no=0, offset=-1). Expected tokens are: [CURLYOPEN, SQUAREOPEN, STRING, NUMBER, TRUE, FALSE, NULL]



=== REPORTED CRASH DATA ===
BugReportExceptionHandler#handleException:
No data collected.

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: RemoteControl request processor (83)
jakarta.json.stream.JsonParsingException: Invalid token=EOF at (line no=1, column no=0, offset=-1). Expected tokens are: [CURLYOPEN, SQUAREOPEN, STRING, NUMBER, TRUE, FALSE, NULL]
	at org.eclipse.parsson.JsonParserImpl.parsingException(JsonParserImpl.java:455)
	at org.eclipse.parsson.JsonParserImpl.access$1000(JsonParserImpl.java:53)
	at org.eclipse.parsson.JsonParserImpl$NoneContext.getNextEvent(JsonParserImpl.java:443)
	at org.eclipse.parsson.JsonParserImpl.next(JsonParserImpl.java:363)
	at org.eclipse.parsson.JsonReaderImpl.read(JsonReaderImpl.java:63)
	at org.openstreetmap.josm.data.oauth.OAuth20Token.<init>(OAuth20Token.java:57)
	at org.openstreetmap.josm.data.oauth.OAuth20Authorization$OAuth20AuthorizationHandler.handleRequest(OAuth20Authorization.java:100)
	at org.openstreetmap.josm.io.remotecontrol.handler.AuthorizationHandler.handleRequest(AuthorizationHandler.java:130)
	at org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.handle(RequestHandler.java:87)
	at org.openstreetmap.josm.io.remotecontrol.RequestProcessor.run(RequestProcessor.java:266)

`

I reckon that this issues is related to the tokens being generated because I have tested with OHM-staging API. Some tokens work, but others do not.

Github Ticket: https://github.com/OpenHistoricalMap/issues/issues/610#issuecomment-1985755649

Attachments (0)

Change History (5)

comment:1 by taylor.smock, 9 months ago

Owner: changed from team to Rub21
Status: newneedinfo

I need some sample tokens that were not working.

comment:2 by Rub21, 9 months ago

Here some tokens:

  • OHM-staging - JOSM -4
Client ID	UxuQ6ot1wBLd9_FDukoVEkXXWoSQB2aXrvJviTRIqk4
Client Secret	huJ9MDw54OWoB72dm6ODgBMCQMEVms2SKDwbvbPlBi8
  • OHM-staging - JOSM -5
Client ID	5YjXjcO2yCBep6oFDJje3NDj5vG51n-MTKuP-WvLgAs
Client Secret	HAqwr2f8wzkyTcaCSCgTOhq235if5LeK-7uRwLkbO-E
Last edited 6 months ago by taylor.smock (previous) (diff)

comment:3 by skyper, 7 months ago

Cc: tsmock removed
Keywords: OAuth2 access token added
Owner: changed from Rub21 to taylor.smock
Status: needinfonew

comment:4 by taylor.smock, 6 months ago

Owner: changed from taylor.smock to Rub21
Status: newneedinfo

I just went to check and see if this was still a problem; does the OHM staging server get reset every so often? I wasn't able to reproduce (I just got a message from the server that the client id wasn't usable).

comment:5 by taylor.smock, 4 months ago

Resolution: needinfo
Status: needinfoclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Rub21.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.