Magento 2 How to change customer password using GraphQL
In this article we will expalin you how to reset or change customer password using GraphQL. Customer token need to set in the header of GraphQL using Generate Customer Token.
Use the changeCustomerPassword
mutation to change the password for the logged-in customer.
Syntax
mutation {
changeCustomerPassword(
currentPassword: String!
newPassword: String!
) {
Customer
}
}
In the following examaple update customer password.
Request
saveCopyzoom_out_mapmutation {
changeCustomerPassword(
currentPassword: "Dev@test123"
newPassword: "Dev@test1234"
) {
firstname
lastname
email
}
}
Response
saveCopyzoom_out_map{
"data": {
"changeCustomerPassword": {
"firstname": "Devtest",
"lastname": "Developer",
"email": "devtest@example.com"
}
}
}
That's it!!
If you are looking for more GraphQL solutions then check out our another article which is List of GraphQL Queries and Mutations for Magento 2.
I hope this article helps you to find what you were looking for.
Bookmark it for your future reference. Do comment below if you have any other questions on that.
P.S. Do share this article with your team.