Cannot find detailed explanation, how to update current user metadata. I’m developing SPA, want to do profile compltion through app custom form.
async updateMetadata(data: TUserMetadata) {
const token = await getAccessTokenSilently({
authorizationParams: {
audience: `https://${state.config?.domain}/api/v2/`,
scope: "update:current_user_metadata",
},
});
const response = await fetch(`https://${state.config?.domain}/api/v2/users/${user.value?.sub}`, {
method: "PATCH",
headers: {
'Authorization': 'Bearer ' + token,
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({ user_metadata: data })
})
return unwrapResponse(response, "json");
},
Calling getAccessTokenSilently like this, system respond with error: “Consent required”
What I’m doing wrong? Maybe somthing else I should have done before requesting auth token?
Are these operations even possible in the free package?