-
-
Notifications
You must be signed in to change notification settings - Fork 514
GraphQL: Add File & LogInWith #702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
afc933b
Add file documentation
Moumouls 0fde947
add loginWith doc
Moumouls 4f9b308
Update _includes/graphql/users.md
TomWFox 68c8e18
Apply suggestions from code review
TomWFox 72f6053
Apply suggestions from code review
TomWFox bf57c2b
Merge branch 'gh-pages' into update-gql-doc
TomWFox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ To sign up a new user, use the `signUp` mutation. For example: | |
mutation signUp { | ||
signUp( | ||
input: { | ||
userFields: { | ||
fields: { | ||
username: "johndoe" | ||
password: "ASuperStrongPassword" | ||
email: "[email protected]" | ||
|
@@ -72,6 +72,7 @@ After you allow users to sign up, you need to let them log in to their account w | |
} | ||
``` | ||
```graphql | ||
# GraphQL | ||
mutation logIn { | ||
logIn(input: { username: "johndoe", password: "ASuperStrongPassword" }) { | ||
viewer { | ||
|
@@ -103,6 +104,59 @@ mutation logIn { | |
|
||
Note that, when the user logs in, Parse Server generates a new `sessionToken` for future operations. | ||
|
||
## 3rd Party Auth | ||
TomWFox marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
You can log in a user via a 3rd party auth system (Custom, Facebook, Twitter, etc...) with the `logInWith` mutation. | ||
TomWFox marked this conversation as resolved.
Show resolved
Hide resolved
|
||
For more information about the use of authData: [AuthData Guide](https://docs.parseplatform.org/parse-server/guide/#supported-3rd-party-authentications) | ||
TomWFox marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```js | ||
// Header | ||
{ | ||
"X-Parse-Application-Id": "APPLICATION_ID", | ||
"X-Parse-Master-Key": "MASTER_KEY" // optional | ||
} | ||
``` | ||
```graphql | ||
# GraphQL | ||
mutation LoginWithFacebook { | ||
logInWith( | ||
input: { | ||
authData: { | ||
facebook: { | ||
id: "user's Facebook id number as a string" | ||
access_token: "Facebook access token for the user" | ||
expiration_date: "token expiration date" | ||
} | ||
} | ||
fields: { email: "[email protected]" } | ||
} | ||
) { | ||
viewer { | ||
sessionToken | ||
user { | ||
id | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
```js | ||
// Response | ||
{ | ||
"data": { | ||
"logInWith": { | ||
"viewer": { | ||
"sessionToken": "r:b0dfad1eeafa4425d9508f1c0a15c3fa", | ||
"user": { | ||
"email": "[email protected]" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Using Session Token | ||
|
||
For authenticating an operation as a specific user, you need to pass the `X-Parse-Session-Token` header with its valid session token. | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.