From 7f8ade5fc124b946c6bfef58be427f604cc78369 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Wed, 4 Sep 2024 23:11:16 +0200 Subject: [PATCH] fix(api): :bug: Correctly decode URI component when obtaining token. Prevents redirect_uri mismatch by normalizing URL encoding --- api/oauth/token/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/oauth/token/index.ts b/api/oauth/token/index.ts index 2d718557..2c249350 100644 --- a/api/oauth/token/index.ts +++ b/api/oauth/token/index.ts @@ -112,7 +112,10 @@ export default apiRoute((app) => where: (token, { eq, and }) => and( eq(token.code, code), - eq(token.redirectUri, redirect_uri), + eq( + token.redirectUri, + decodeURIComponent(redirect_uri), + ), eq(token.clientId, client_id), ), });