Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving edits results in an oauth2 error pop-up #10250

Open
1231231231231231231231231 opened this issue May 21, 2024 · 3 comments
Open

Saving edits results in an oauth2 error pop-up #10250

1231231231231231231231231 opened this issue May 21, 2024 · 3 comments

Comments

@1231231231231231231231231
Copy link

1231231231231231231231231 commented May 21, 2024

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

@1231231231231231231231231
Copy link
Author

1231231231231231231231231 commented May 21, 2024

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?

@1231231231231231231231231
Copy link
Author

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.

@vpzomtrrfrt
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants