I have an Ionic React app and I want to allow users to change their email addresses.
However, when I try to change the email address in a PATCH
request, I get the following error:
{
"jsonapi":{
"version":"1.0",
"meta":{
"links":{
"self":{
"href":"http:\/\/jsonapi.org\/format\/1.0\/"
}
}
}
},
"errors":[
{
"title":"Unprocessable Entity",
"status":"422",
"detail":"mail: \u300c\u30e1\u5fc5\u9808\u3067\u3059\u3002",
"source":{
"pointer":"\/data\/attributes\/mail"
}
},
{
"title":"Unprocessable Entity",
"status":"422",
"detail":"mail: Your current password is missing or incorrect; it\u0027s required to change the \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9.",
"source":{
"pointer":"\/data\/attributes\/mail"
}
}
]
}
This doesn't really make sense because the user already has a JWT to authenticate.
I found this drupal.org issue that has been marked as fixed, but this is just how to provide the current password to update the email address.
Instead, I would like to use the JWT or some other means to easily update the email address without inputting the password again.
The Nocurrent Pass module disables the password check when changing one's email address or password, which is what I want, but it does so by means of hook_form_alter()
, which means it doesn't remove the check for JSON:API.