Fix non spec conformant login oauth flow #24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current implementation uses a trick where the redirect URL is passed with a parameter specifying the userID so on return, the specific userID can be extracted from the called URL again. This is against the spec of Oauths RFC and does currently work with Github, however while trying to reuse the code for interacting with the Wrike API it turned out to be problematic.
This is what I'm referring to:
Now as during the creation of the github oauth app, the redirect URL is specified without the UserID field, it should not work.
I edited the code to instead put the userID in the state field and extract it when returning back to maubot.
I tried to make sure that the delimiter between the userID and the state would not run into any conflicts. The chosen "%" is not a viable character for userIDs in matrix (https://spec.matrix.org/v1.8/appendices/#user-identifiers) and also poses no problems with URLs.
As I'm working on my end with different APIs from Wrike, would it be possible for you to check if these commits work on Github as well or if you run into other issues?