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

megalodon sends JSON-encoded payloads to OAuth endpoints #96

Open
aumetra opened this issue Jun 18, 2023 · 2 comments
Open

megalodon sends JSON-encoded payloads to OAuth endpoints #96

aumetra opened this issue Jun 18, 2023 · 2 comments

Comments

@aumetra
Copy link

aumetra commented Jun 18, 2023

When trying to get the access token, Ebou sends a JSON-encoded payload to the /oauth/token endpoint.

While this is fine with Mastodon (since Rails just deserializes based on the Content-Type header), this causes issues with alternative implementations that actually follow the OAuth2 spec closely, which states that all the body contents have to be application/x-www-form-urlencoded.

To cite RFC 6797; Section 4.1.1:

The client constructs the request URI by adding the following parameters to the query component of the authorization endpoint URI using the "application/x-www-form-urlencoded" format

Looking at the code, there seem to be two solutions to this:

  1. Submit everything to the API as application/x-www-form-urlencoded bodies. This should work fine.
  2. Make a special case for the OAuth endpoints to submit the data as application/x-www-form-urlencoded instead of application/json (this is more effort, not sure if it's worth it)
@h3poteto
Copy link
Owner

h3poteto commented Jun 19, 2023

Submit everything to the API as application/x-www-form-urlencoded bodies. This should work fine.

I wonder if other SNS can handle application/x-www-form-urlencoded other than OAuth endpoints. Does this way work fine for other SNS? e.g. Pleroma and Friendica.

Make a special case for the OAuth endpoints to submit the data as application/x-www-form-urlencoded instead of application/json (this is more effort, not sure if it's worth it)

I prefer this way.

@aumetra
Copy link
Author

aumetra commented Jun 19, 2023

Pleroma should be able to handle it IIRC, not sure about Friendica (never used it)

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