Skip to content

Commit

Permalink
note about blocks
Browse files Browse the repository at this point in the history
note that 403 nay be returned both when user is blocked and when app was no authorized
different actions should be taken in both cases - if user gave no necessary oauth permission, then app should attempt log-in
if user was blocked, then appropriate message should be shown
especially in case of zero-hour blocks just relogging in may apparently swallow the attempted communication
  • Loading branch information
matkoniecz committed Dec 29, 2024
1 parent 45a51eb commit a557a05
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ inline fun <T> wrapApiClientExceptions(block: () -> T): T =
throw ConnectionException(e.message, e)
}
// authorization is something we can handle (by requiring (re-)login of the user)
// note that user may be also blocked, this may require special handling
HttpStatusCode.Forbidden, HttpStatusCode.Unauthorized -> {
throw AuthorizationException(e.message, e)
}
Expand Down

2 comments on commit a557a05

@westnordost
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like an issue for openstreetmap-website, though. In StreetComplete, the user is forced to log in again. So, for login, the user is redirected to osm.org. That message should then be displayed in a modal way just after login and before authorizing StreetComplete.

And in case it is not a zero-hour block but a longer block, the message that led to the block would still be shown, only the openstreetmap-website doesn't forward the user to the oauth step. (In case the user is not allowed to create oauth tokens when blocked, that is.)

There is nothing we can do to differentiate if the error code is the same. We don't want to use the error message for logic, because as human readable text, we have to assume that that text could change anytime.

@matkoniecz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://community.openstreetmap.org/t/is-this-the-same-person/123461/23 has a potential solution that is not absolutely terrible

still not sure is it good enough

I am now planning to experiment with blocking myself to see the behaviour in app

Please sign in to comment.