ma1uta / ma1sd

Federated Matrix Identity Server (formerly fork of kamax/mxisd)
GNU Affero General Public License v3.0
167 stars 56 forks source link

Response with 401 M_UNAUTHORIZED #9

Closed mjattiot closed 4 years ago

mjattiot commented 4 years ago

Hello @ma1uta ! First thank you for implementing v2 API and supporting this project.

I have an improvement suggestion : I think ma1sd should response with 401 M_UNAUTHORIZED when the access_token is missing or invalid, as specified by the spec. It would allow clients to trying login in again (i.e. account/register) on such an error.

Today it's not a priority because matrix-js-sdk doesn't seem to handle 401, so if my is_access_token expires, it seems that riot doesn't try to register again. Still if they implement such behavior in the future they would need to have a 401 response. Right now ma1sd is answering with 500 and the following exception: io.kamax.mxisd.exception.InvalidCredentialsException: Supplied credentials are invalid

What do you think @ma1uta ?

ma1uta commented 4 years ago

Thanks. Yes, there was a bug and I have fixed it in the https://github.com/ma1uta/ma1sd/commit/774ebf4fa8e7a093104243a5a53c2e0f43cfdb44 commit.

mjattiot commented 4 years ago

Cool thank you for your quick fix !