disquietone
KKinde
•Created by disquietone on 10/28/2024 in #💻┃support
Updating boolean user properties
Hi, I need some help setting user properties. I can set text properties fine, but boolean properties are not working. If I set it to false in the website, then sen a value of 'false',it sets to false. In fact sending any string to the API sets it to false. If I send true, it doesnt get set to true and stays false.
Regardless of what I set as the value, I get success from the API, even if i send a value of 'blue', which doesnt make much sense.
Here is the code (I am using axios for the calls)
export const setUserRegistered = async (params) => {
const { request, kuid } = params
const prop = 'is_registered' // 'is_registered'
const value = true
const apiUrl =
/api/v1/users/${kuid}/properties/${prop}?value=${value}
const headers = {
'Content-Type': 'application/json',
Audience: 'https://mierabella-dev.au.kinde.com/api',
Accept: 'application/json',
Authorization: Bearer ${request.kindeAccessToken}
,
}
const result = await request.kindeClient
.put(apiUrl, {}, headers)
.then((data) => {
console.log('done', data.data)
})
.catch((err) => {
console.log('failed', kuid, err.response.data)
})
}
and here is the data returned
{ code: 'PROPERTY_VALUE_UPDATED', message: 'Property value updated' }7 replies