mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
fix(api): 🐛 Only decode URI, not full URI component, in application's redirect_url
This commit is contained in:
parent
53184bbe99
commit
d63196b5ee
|
|
@ -76,11 +76,9 @@ export default apiRoute((app) =>
|
|||
|
||||
// Redirect back to application
|
||||
return context.redirect(
|
||||
encodeURI(
|
||||
`${redirect_uri}?${new URLSearchParams({
|
||||
code,
|
||||
}).toString()}`,
|
||||
),
|
||||
`${redirect_uri}?${new URLSearchParams({
|
||||
code,
|
||||
}).toString()}`,
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ export default apiRoute((app) =>
|
|||
.insert(Applications)
|
||||
.values({
|
||||
name: client_name || "",
|
||||
redirectUri: decodeURIComponent(redirect_uris) || "",
|
||||
redirectUri: decodeURI(redirect_uris) || "",
|
||||
scopes: scopes || "read",
|
||||
website: website || null,
|
||||
clientId: randomString(32, "base64url"),
|
||||
|
|
|
|||
|
|
@ -112,10 +112,7 @@ export default apiRoute((app) =>
|
|||
where: (token, { eq, and }) =>
|
||||
and(
|
||||
eq(token.code, code),
|
||||
eq(
|
||||
token.redirectUri,
|
||||
decodeURIComponent(redirect_uri),
|
||||
),
|
||||
eq(token.redirectUri, decodeURI(redirect_uri)),
|
||||
eq(token.clientId, client_id),
|
||||
),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ export default (plugin: PluginType) =>
|
|||
redirectUri.searchParams.append("code", code);
|
||||
state && redirectUri.searchParams.append("state", state);
|
||||
|
||||
return context.redirect(encodeURI(redirectUri.toString()));
|
||||
return context.redirect(redirectUri.toString());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue