Skip to content

megalodon sends JSON-encoded payloads to OAuth endpoints #96

@aumetra

Description

@aumetra

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions