Unable to associate entry with a User via JWT


I am trying to create an entry ‘location’, via an authenticated user. It gets added to the DB, but it isn’t associated with the user. I am using JWT. See all screenshots. Going mad here, no idea whats going wrong. I have checked the token, it is correct.
Any help would be greatly appriciated, not sure wat my next move is here otherwise.

const res =  await fetch (`${API_URL}/api/locations`, {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                    Authorization: `Bearer ${token}`
                body: valuesObj,
            }).then((res) => res.json())

What’s the valuesObj value?

Hey @jason_grant,

Setting up a relationship between “Users” and your “locations” content type is not enough. In the controller for locations, you need to tell it to insert the reference using the user from ctx.state.

Don’t fall into the trap of specifying the user in valuesObj as this would allow anyone calling the API the ability to make a “location” belong to someone else.

Hope this helps!