Skip to content
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

docs: Changed the GET method to POST on logging in #858

Merged
merged 1 commit into from
Nov 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions _includes/rest/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,31 @@ The response body is a JSON object containing the `objectId`, the `createdAt` ti

## Logging In

After you allow users to sign up, you need to let them log in to their account with a username and password in the future. To do this, send a GET request to the <code class="highlighter-rouge"><span class="custom-parse-server-mount">/parse/</span>login</code> endpoint with `username` and `password` as URL-encoded parameters:
After you allow users to sign up, you need to let them log in to their account with a username and password in the future. To do this, send a POST request to the <code class="highlighter-rouge"><span class="custom-parse-server-mount">/parse/</span>login</code> endpoint with `username` and `password` as parameters in the body:


<div class="language-toggle">
<pre><code class="bash">
curl -X GET \
curl -X POST \
-H "X-Parse-Application-Id: <span class="custom-parse-server-appid">${APPLICATION_ID}</span>" \
-H "X-Parse-REST-API-Key: <span class="custom-parse-server-restapikey">${REST_API_KEY}</span>" \
-H "X-Parse-Revocable-Session: 1" \
-G \
--data-urlencode 'username=cooldude6' \
--data-urlencode 'password=p_n7!-e8' \
-H "Content-Type: application/json" \
-d '{"username":"cooldude6","password":"p_n7!-e8"}' \
<span class="custom-parse-server-protocol">https</span>://<span class="custom-parse-server-url">YOUR.PARSE-SERVER.HERE</span><span class="custom-parse-server-mount">/parse/</span>login
</code></pre>
<pre><code class="python">
import json,httplib,urllib
import json,httplib
connection = httplib.HTTPSConnection('<span class="custom-parse-server-url">YOUR.PARSE-SERVER.HERE</span>', 443)
params = urllib.urlencode({"username":"cooldude6","password":"p_n7!-e8"})
connection.connect()
connection.request('GET', '<span class="custom-parse-server-mount">/parse/</span>login?%s' % params, '', {
connection.request('POST', '<span class="custom-parse-server-mount">/parse/</span>login', json.dumps({
"username": "cooldude6",
"password": "p_n7!-e8"
}), {
"X-Parse-Application-Id": "<span class="custom-parse-server-appid">${APPLICATION_ID}</span>",
"X-Parse-REST-API-Key": "<span class="custom-parse-server-restapikey">${REST_API_KEY}</span>",
"X-Parse-Revocable-Session": "1"
"X-Parse-Revocable-Session": "1",
"Content-Type": "application/json"
})
result = json.loads(connection.getresponse().read())
print result
Expand Down