[backend/masto-client] Fix /oauth/token

This commit is contained in:
Laura Hausmann 2024-01-31 22:19:22 +01:00
parent c293a0bd3c
commit d255de0dd0
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -87,7 +87,7 @@ public class MastodonAuthController(DatabaseContext db) : Controller {
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(MastodonErrorResponse))]
public async Task<IActionResult> GetOauthToken([FromHybrid] MastodonAuth.OauthTokenRequest request) {
//TODO: app-level access (grant_type = "client_credentials")
if (request.GrantType != "code")
if (request.GrantType != "authorization_code")
throw GracefulException.BadRequest("Invalid grant_type");
var token = await db.OauthTokens.FirstOrDefaultAsync(p => p.Code == request.Code &&
p.App.ClientId == request.ClientId &&