[backend/masto-client] Improve error message when requesting an oauth token with a grant_type other than authorization_code
This commit is contained in:
parent
0cd754f4c2
commit
9c8debb5ed
1 changed files with 1 additions and 1 deletions
|
@ -89,7 +89,7 @@ public class AuthController(DatabaseContext db, MetaService meta) : ControllerBa
|
||||||
{
|
{
|
||||||
//TODO: app-level access (grant_type = "client_credentials")
|
//TODO: app-level access (grant_type = "client_credentials")
|
||||||
if (request.GrantType != "authorization_code")
|
if (request.GrantType != "authorization_code")
|
||||||
throw GracefulException.BadRequest("Invalid grant_type");
|
throw GracefulException.BadRequest($"Invalid grant_type, only authorization_code is supported.");
|
||||||
var token = await db.OauthTokens.FirstOrDefaultAsync(p => p.Code == request.Code &&
|
var token = await db.OauthTokens.FirstOrDefaultAsync(p => p.Code == request.Code &&
|
||||||
p.App.ClientId == request.ClientId &&
|
p.App.ClientId == request.ClientId &&
|
||||||
p.App.ClientSecret == request.ClientSecret);
|
p.App.ClientSecret == request.ClientSecret);
|
||||||
|
|
Loading…
Add table
Reference in a new issue