I want to congratulate you for getting to this point in this book – I know we have covered a lot, but we are almost there! Now, we are going to try and log in with GraphQL (how crazy is that?).
First, we need to write our login mutation:
mutation {
login(
input: {
email: "fake@email.com",
password: "123456"
}
) {
token
}
}
Then, we need to log our user in by using "fake@email.com" as our email and "123456" as our password. These do not exist in our database:
Because the email does not exist in our database, an "Invalid Login" error message will be returned. Now, let's add the correct email but use a fake password:
As you can see, we are receiving the exact same error ("Invalid Login"). This is because we don't want to provide too much information about what's wrong with the login as someone may be trying to hack another user. If we say something such as "Invalid...