I am using
supertokens-web-js
sdk with sveltekit... it is working properly, however, after a user successfully signs in, I am getting this error:
500 url.clone is not a function
My init function:
js
export function init_supertoken_auth() {
try {
SuperTokens.init({
appInfo: {
apiDomain: "....",
apiBasePath: "/",
appName: "....",
},
recipeList: [
Session.init(),
ThirdPartyEmailPassword.init(),
],
enableDebugLogs: true,
});
} catch (error) {
console.log({ error })
}
}
And my sign in function looks like this:
js
export async function sign_in_handler(event) {
try {
const raw_form_data = new FormData(event.target);
const email = raw_form_data.get('email') as string;
const password = raw_form_data.get('password') as string;
const response = await emailPasswordSignIn({
formFields: [
{
id: 'email',
value: email
},
{
id: 'password',
value: password
}
],
});
if (response.status === 'FIELD_ERROR') {
response.formFields.forEach((formField) => {
if (formField.id === 'email') {
// Email validation failed (for example incorrect email syntax).
console.log(formField.error)
}
});
} else if (response.status === 'WRONG_CREDENTIALS_ERROR') {
console.log('Email password combination is incorrect.')
} else {
// sign in successful. The session tokens are automatically handled by
// the frontend SDK.
console.log('sign in success')
await post_sign_in_flow()
}
} catch (error: any) {
if (error.isSuperTokensGeneralError === true) {
// this may be a custom error message sent from the API by you.
console.log(error.message)
} else {
console.log(error)
}
}
}
How do I prevent the url clone? the sign in works and session is initiated properly.