Logging in
Logging in an existing user through the Parse GraphQL API
Problem
You want to log in an existing user in your backend through the Parse GraphQL API.
Solution
Using the Parse GraphQL API, you can log in an existing user just by sending the user’s credentials through the logIn mutation. The username and password arguments are mandatory. The mutation will return back all users’ fields, including the sessionToken.
After logging in an existing user, you can use the authenticating an user recipe to send the sessionToken in the following operations so they will be executed in the behavior of this user. You can also use the logging out recipe to destroy the sessionToken.
Version Information
Depending on the version of Parse you choose to run, the GraphQL queries, mutations and results will be slightly different. Please choose the correct example along with the Parse version you are running.
Parse Server 3.10.0 and later
1 mutation LogIn{
2 logIn(input: {
3 username: "somefolk"
4 password: "somepassword"
5 }){
6 viewer{
7 user{
8 id
9 createdAt
10 updatedAt
11 username
12 }
13 sessionToken
14 }
15 }
16 }