autherr 2.0.38 → 2.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -98,20 +98,23 @@ export function AutherrProvider({
|
|
|
98
98
|
// window.location.href = url.toString();
|
|
99
99
|
// };
|
|
100
100
|
|
|
101
|
+
let redirecting = false;
|
|
101
102
|
const buildRedirect = async (path: "login" | "signup") => {
|
|
103
|
+
if(redirecting) return;
|
|
104
|
+
redirecting=true;
|
|
102
105
|
const state = crypto.randomUUID();
|
|
103
106
|
const assertion = await createClientAssertion(clientId, clientPrivateKey);
|
|
104
|
-
const encodedAssertion = encodeURIComponent(assertion);
|
|
105
107
|
|
|
106
108
|
const form = document.createElement("form");
|
|
107
109
|
form.method = "POST";
|
|
108
|
-
form.action =
|
|
110
|
+
form.action =
|
|
111
|
+
`${baseUrl}/auth/${path}` +
|
|
112
|
+
`?client_id=${encodeURIComponent(clientId)}` +
|
|
113
|
+
`&redirect_uri=${encodeURIComponent(window.location.origin)}` +
|
|
114
|
+
`&state=${encodeURIComponent(state)}`;
|
|
109
115
|
|
|
110
116
|
form.innerHTML = `
|
|
111
|
-
<input type="hidden" name="
|
|
112
|
-
<input type="hidden" name="redirect_uri" value="${window.location.origin}" />
|
|
113
|
-
<input type="hidden" name="state" value="${state}" />
|
|
114
|
-
<input type="hidden" name="client_assertion" value="${encodedAssertion}" />
|
|
117
|
+
<input type="hidden" name="client_assertion" value="${encodeURIComponent(assertion)}" />
|
|
115
118
|
`;
|
|
116
119
|
|
|
117
120
|
document.body.appendChild(form);
|
|
@@ -120,6 +123,7 @@ export function AutherrProvider({
|
|
|
120
123
|
|
|
121
124
|
|
|
122
125
|
|
|
126
|
+
|
|
123
127
|
const login = async () => buildRedirect("login");
|
|
124
128
|
const signup = async () => buildRedirect("signup");
|
|
125
129
|
|