<p></p>
<p>(Originally posted in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="410617971" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/2145" data-hovercard-type="pull_request" data-hovercard-url="/openstreetmap/openstreetmap-website/pull/2145/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/pull/2145">#2145</a>)</p>
<p>Now with OAuth 2.0 in production, I wanted to revisit the <a href="https://datatracker.ietf.org/doc/html/rfc7662" rel="nofollow">token introspection</a> topic, which is handled by the <code>/oauth2/introspect</code> endpoint.</p>
<p>While the Doorkeeper config supports this endpoint, it seems the <code>oauth_filter</code> gem is intercepting the call. It redirects is to the <a href="https://github.com/openstreetmap/openstreetmap-website/blob/master/app/models/oauth2_token.rb">Oauth2Token model</a>, which is not related to Doorkeeper, and then fails with a 415 Unsupported Media Type error.</p>
<p>I'm not at all familiar with any oauth_filter details. All I could find was the query below over at: <a href="https://github.com/pelle/oauth-plugin/blob/master/lib/oauth/rack/oauth_filter.rb#L27">https://github.com/pelle/oauth-plugin/blob/master/lib/oauth/rack/oauth_filter.rb#L27</a></p>
<p>Does it still make sense to have this code in place for OAuth2.0, now that we're using Doorkeeper?</p>
<pre><code>Started POST "/oauth2/introspect" for ::1 at 2021-07-02 12:12:20 +0200
Oauth2Token Load (0.9ms) SELECT "oauth_tokens".* FROM "oauth_tokens" WHERE "oauth_tokens"."type" = $1 AND (invalidated_at IS NULL and authorized_at IS NOT NULL and token = 'xyz') ORDER BY "oauth_tokens"."id" ASC LIMIT $2 [["type", "Oauth2Token"], ["LIMIT", 1]]
↳ config/initializers/compressed_requests.rb:27:in `call'
Processing by Doorkeeper::TokensController#introspect as JSON
Parameters: {"token"=>"xyz"}
Filter chain halted as :enforce_content_type rendered or redirected
Completed 415 Unsupported Media Type in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 87)
</code></pre>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/issues/3245">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLLXRWJWFJCLYBBIQJDTVWLVLANCNFSM47WPZ3VA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AAK2OLL53UOJLXYQUJVKR7TTVWLVLA5CNFSM47WPZ3VKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4N6FBLQQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/issues/3245",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/3245",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>