Auth V5 Failed to construct 'URL'
Answered
Prairie yellowjacket posted this in #help-forum
Prairie yellowjacketOP
Hey guys, I have problem with Next Auth v5, I keep getting error on simple credentials sign in: Failed to construct 'URL' error, only with redirect: false, does anyone see what am I doing wrong?
const loginUser: SubmitHandler<InputType> = async (data) => {
const result = await signIn('credentials', {
redirect: false,
username: data.email,
password: data.password
});
if (!result?.ok) {
toast.error(result?.error);
return;
}
}; Credentials({
async authorize(credentials) {
if (!credentials?.email || !credentials?.password) return null;
const { email, password } = credentials;
const res = await fetch(process.env.NEXT_PUBLIC_BACKEND_API + '/auth/login', {
method: 'POST',
body: JSON.stringify({
email: email,
password
}),
headers: {
'Content-Type': 'application/json'
}
});
if (!res.ok) {
throw new Error('User name or password is not correct');
}
const user = await res.json();
return user;
}
})Answered by Prairie yellowjacket
answer: it was bug, fixed from new patch ^5.0.0-beta.5
1 Reply
Prairie yellowjacketOP
answer: it was bug, fixed from new patch ^5.0.0-beta.5
Answer