Problem statement
We can not update the user’s app_metadata after signing in with a post-login
action. Below is the script.
fetch(path, options)
.then((response) => {[...]
}).then((body) => { if ( <some condition>) {
api.user.setAppMetadata("key", "value");
return; }
Cause
You called api.user.setAppMetadata(key,value)
inside a fetch
command.
Solution
Please update the post-login
action by moving api.user.setAppMetadata(key,value)
outside the fetch().then()
clause.