mirror of
https://github.com/versia-pub/server.git
synced 2026-01-27 04:36:02 +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
|
// Redirect back to application
|
||||||
return context.redirect(
|
return context.redirect(
|
||||||
encodeURI(
|
|
||||||
`${redirect_uri}?${new URLSearchParams({
|
`${redirect_uri}?${new URLSearchParams({
|
||||||
code,
|
code,
|
||||||
}).toString()}`,
|
}).toString()}`,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ export default apiRoute((app) =>
|
||||||
.insert(Applications)
|
.insert(Applications)
|
||||||
.values({
|
.values({
|
||||||
name: client_name || "",
|
name: client_name || "",
|
||||||
redirectUri: decodeURIComponent(redirect_uris) || "",
|
redirectUri: decodeURI(redirect_uris) || "",
|
||||||
scopes: scopes || "read",
|
scopes: scopes || "read",
|
||||||
website: website || null,
|
website: website || null,
|
||||||
clientId: randomString(32, "base64url"),
|
clientId: randomString(32, "base64url"),
|
||||||
|
|
|
||||||
|
|
@ -112,10 +112,7 @@ export default apiRoute((app) =>
|
||||||
where: (token, { eq, and }) =>
|
where: (token, { eq, and }) =>
|
||||||
and(
|
and(
|
||||||
eq(token.code, code),
|
eq(token.code, code),
|
||||||
eq(
|
eq(token.redirectUri, decodeURI(redirect_uri)),
|
||||||
token.redirectUri,
|
|
||||||
decodeURIComponent(redirect_uri),
|
|
||||||
),
|
|
||||||
eq(token.clientId, client_id),
|
eq(token.clientId, client_id),
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -303,7 +303,7 @@ export default (plugin: PluginType) =>
|
||||||
redirectUri.searchParams.append("code", code);
|
redirectUri.searchParams.append("code", code);
|
||||||
state && redirectUri.searchParams.append("state", state);
|
state && redirectUri.searchParams.append("state", state);
|
||||||
|
|
||||||
return context.redirect(encodeURI(redirectUri.toString()));
|
return context.redirect(redirectUri.toString());
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue