fix(plugin): 🐛 Don't incorrectly call errorSearchParams before initialization in callback

This commit is contained in:
Jesse Wierzbinski 2024-10-11 17:23:51 +02:00
parent a265e9df41
commit d000914f61
No known key found for this signature in database
2 changed files with 22 additions and 13 deletions

View file

@ -91,7 +91,19 @@ export default (plugin: PluginType) => {
flowId,
currentUrl,
redirectUrl,
(error, message) => {
(error, message, flow) => {
const errorSearchParams = new URLSearchParams(
Object.entries({
redirect_uri: flow?.application?.redirectUri,
client_id: flow?.application?.clientId,
response_type: "code",
scope: flow?.application?.scopes,
}).filter(([_, value]) => value !== undefined) as [
string,
string,
][],
);
errorSearchParams.append("error", error);
errorSearchParams.append("error_description", message);