Changing customer email

Ive been trying to change a custy email but it doesnt seem to work. It seems to change the email in the API but when I try to login it doesnt recognize the user.




curl -H "FOXY-API-VERSION: 1" -H "Authorization: Bearer TOKEN" https://api.foxycart.com/stores/11/customers?limit=1&email=old@email.com

// I find the self link with ID

curl -H "FOXY-API-VERSION: 1" -H "Authorization: Bearer TOKEN" -X PATCH https://api.foxycart.com/customers/222222 -d "email=new@email.com

// Seems to work but no go - no user with that email can login to my store

Comments
  • fc_marijafc_marija FoxyCart Team
    Hi @happycloud -

    I'm going to start a whispered conversion.
  • fc_marijafc_marija FoxyCart Team
    @happycloud I apologize we don't have an immediate solution for this issue, but I've opened a ticket for our developer to take a look at it. We'll get back to you as soon as we have something.
  • lukeluke FoxyCart Team
    Hey @happycloud. I think I figured out the issue here. The customer record you were updating was an anonymous record for a guest checkout (is_anonymous = 1). If you want to view just active customer accounts, add the filter `is_anonymous=0` to your query link. I'm a little confused as this is supposed to filter out anonymous accounts by default, so we'll take a look at that and figure out why it's not working as expected. If you use that filter, you should get back one customer record for that store.
  • lukeluke FoxyCart Team
    Yep, I just confirmed the issue with our hAPI that doesn't default a GET of customer records to filter out anonymous entries. We've got a fix in to QA, but for now you can just add that filter described earlier and you should be good to go.
  • Ok I will try that. On another note - I noticed that to get a new token I have to use php's base64_encode as CLI base64 or openssl enc -base64 give different outputs - not sure why. Only the php one works. Ive noticed something similar a while back when using the datafeed xml - I could not use Node to create the encrypted one to test - always had to use php.
  • Interesting. Only the last char differs. Its a 'K' for base64/openssl and '=' for php. Replacing the last chars makes it work.
  • So these are output padding - not sure why base64/openssl uses K (I just asked SO as Wikipedia failed). But it would be nice for your code to take this into account - I bet you do a base64 string comparison which would cause openssl to fail. Perhaps removing padding characters first.
Sign In or Register to comment.