iD icon indicating copy to clipboard operation
iD copied to clipboard

Saving edits results in an oauth2 error pop-up

Open 1231231231231231231231231 opened this issue 1 year ago • 3 comments

URL

https://www.openstreetmap.org/edit

How to reproduce the issue?

  1. Do a bunch of work
  2. Press save

Screenshot(s) or anything else?

Firefox pop-up, showing a big "An error has occurred, the requested redirect uri is malformed or doesn't match the client redirect URI."

The URL of the pop-up is https://www.openstreetmap.org/oauth2/authorize?client_id=...&code_challenge=S5...&code_challenge_method=S256&redirect_uri=https%3A%2F%2Fwww.openstreetmap.org%2Fidland.html&response_type=code&scope=read_prefs write_prefs write_api read_gpx write_notes&state=...

The UI disables itself but the normal save menu does not appear:
iD UI with the edit area disabled and the side bar empty. The mouse pointer is a "cannot click this" shape on the save button.

localStorage["https://www.openstreetmap.orgoauth2_access_token"] == "" not sure if this is normal?

How can I download my changes if the save menu does not open? localStorage["iD_https://www.openstreetmap.org_saved_history"] contains about 300 kB data, I guess that's my edit. Can I restore this somehow?

Opening the editor in a new tab results in a new iD session, asking me (sigh again...) to take the walkthrough and whether to show third party icons. There are no edits queued in this session. Looking in localStorage, the oauth2 access token value is now filled, but there are also values for ...orgoauth_* (without a 2) that are all empty. The save menu here works normally, though I haven't tried clicking Upload. Can I restore my work here somehow?

Which deployed environments do you see the issue in?

No response

What version numbers does this issue effect?

2.29.0

Which browsers are you seeing this problem on?

Firefox

After opening iD in a new tab as mentioned, I thought maybe copying over the oauth2 token to the initial tab would work. However, the value was now already there (I guess iD filled it in the background and the localStorage data is not tab-specific). Pressing save now worked normally (changeset 151644198).

I'm not sure if you have any idea how to find out what caused this token value to be empty, but:

  • it should always be possible to download your changes. Honestly I found this to be the scariest bit. Bugs can always occur, but unless JS stopped executing on the page altogether, you should be able to just 'have' your work somehow -- and perhaps it should be possible even then via localStorage.
    Perhaps this download option should be given its own shortcut (that one can find in docs somewhere when the UI breaks) and/or be additionally linked from the existing "Map Data" side panel? I think both options would have worked in my case.
  • the browser pop-up window suggests to me the situation is intended to be recoverable; that this pop-up should request a new token from OSM. Perhaps this broke during a recent oauth2 code change?
  • why did the new browser tab not offer to restore the edit? (I also traced the code for this history saving thing to find how to force that pop-up, but did not find any function or UI that I could trigger from the global scope.)
  • more minorly, the UI should not break. Besides that pop-up showing an error, the UI of iD itself also broke. I guessed that pressing Esc would close the sort-of-opened Save UI and it did, so I could retry, but this should not be necessary. Perhaps it should show a "auth token missing, see the pop-up" overlay that you can click away?

Happened again, this time after I left the editor open overnight accidentally so maybe the oauth2 token expired in the meantime?

Very happy I documented here for myself how to fix it, was afraid it would require editing some complicated localStorage thing but no: as stated above, opening iD in a new tab and then pressing upload in the original tab worked also this time.

For anyone seeing this error while trying to use iD from localhost, use 127.0.0.1 instead

vpzomtrrfrt avatar Sep 23 '24 04:09 vpzomtrrfrt

Normally, restoring the auto-saved changes should work to recover the data in case when the oauth token did expire for some reason. But even if that does not work, there's the ability to download the modifications as a osm change file by using the Download osmChange file button in the upload dialog:

Image

tyrasd avatar Mar 11 '25 09:03 tyrasd

I keep wondering why I bother reporting bugs, this is so frustrating

  • No response for nearly a year
  • None of the four problems (comment#2) are addressed
    1. Download osmChange file inaccessible
      • addressed as "it should work" + screenshot - ok yeah thanks but I described that this UI is not reachable when the bug occurs
    2. OAuth2 login flow has malformed redirect URI
      • Completely ignored
    3. Restoring auto-saved changes does not work
      • addressed as "it should work" - ok yeah thanks but I described...
    4. iD's UI got into a broken state
      • Completely ignored
  • No attempt at reproducing, investigating, or resolving any of the issues
  • Someone shares a workaround that was already addressed above as not working
  • Ticket closed

This happens in nearly every project, both commercial and noncommercial

How should I have written this bug report differently to make it clear that the suggested fixes do not work? How can I help developers (since this happens in most projects) understand what users are running into? (And that is besides the fact that the underlying cause is also completely ignored, but I don't know the steps to reproduce so that's more fair.)

Or is it simply a "we don't have the resources to investigate this, sorry" situation? If so, please just say that, I would have total understanding for being overloaded with work, but much less so for closing the ticket as though it's all magically resolved after a year of silence