ngs
06/16/2022, 6:19 PM{ data, error } = await supabase.auth.update({ password: "password" });
workflow throws a 401 (Unauthorized) Password update requires reauthentication
error.
My function is dead simple:
const updatePassword = async () => {
try {
const { user, error } = await supabase.auth.update({
password: "password"
});
if (error) throw error;
updateMessage = `Password updated: ${new Date()}`;
} catch (error: any) {
updateMessage = `${error.error_description || error.message}`;
} finally {
loading = false;
}
};
The same approach is successful for updating email (triggers the 2 step confirmation path) and metadata.
I've also tried using the supabase.auth.api.updateUser(accessToken, {password: 'password'})
, which returns the same error.
Additional wrinkle: supabase.auth.update()
doesn't return the error when passed password: undefined
. And it successfully updates metadata when the payload is: { password: undefined, data: { hello: 'world' } }
Needle
06/16/2022, 6:19 PMsilentworks
06/16/2022, 6:37 PMngs
06/16/2022, 8:34 PMngs
06/16/2022, 8:42 PM"currentSession": {"provider_token": "null", "access_token":...
).
And a supabase.auth.onAuthStateChange()
isn't triggered between signIn and signOut.ngs
06/17/2022, 2:39 AM<script>
import { supabase } from '$lib/supabaseClient';
let email = '';
let password = '';
const handleSignUp = async () => {
const { user, session, error } = await supabase.auth.signUp({
email,
password
});
};
const updatePassword = async () => {
const { user, error } = await supabase.auth.update({
password
});
};
const handleSignIn = async () => {
const { user, session, error } = await supabase.auth.signIn({
email,
password
});
};
</script>
Still getting exactly the same error.:
"code": 401,
"msg": "Password update requires reauthentication."
I'm on:
"@supabase/supabase-js": "^1.35.3"
"@sveltejs/kit": "next"
"svelte": "^3.44.0"
ngs
06/17/2022, 4:05 AM401: Password update requires reauthentication.
doesn't seem quite right.ngs
06/17/2022, 4:08 AMOrigin <url> is not allowed by Access-Control-Allow-Origin. Status code: 401
error.
Any idea how to restore access?Needle
06/17/2022, 3:49 PM