Skip to content

Commit 2d630e0

Browse files
authored
parse-community#857 Changed the GET method to POST on logging in (parse-community#858)
1 parent 3b4d00b commit 2d630e0

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

_includes/rest/users.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -60,28 +60,31 @@ The response body is a JSON object containing the `objectId`, the `createdAt` ti
6060

6161
## Logging In
6262

63-
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:
63+
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:
64+
6465

6566
<div class="language-toggle">
6667
<pre><code class="bash">
67-
curl -X GET \
68+
curl -X POST \
6869
-H "X-Parse-Application-Id: <span class="custom-parse-server-appid">${APPLICATION_ID}</span>" \
6970
-H "X-Parse-REST-API-Key: <span class="custom-parse-server-restapikey">${REST_API_KEY}</span>" \
7071
-H "X-Parse-Revocable-Session: 1" \
71-
-G \
72-
--data-urlencode 'username=cooldude6' \
73-
--data-urlencode 'password=p_n7!-e8' \
72+
-H "Content-Type: application/json" \
73+
-d '{"username":"cooldude6","password":"p_n7!-e8"}' \
7474
<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
7575
</code></pre>
7676
<pre><code class="python">
77-
import json,httplib,urllib
77+
import json,httplib
7878
connection = httplib.HTTPSConnection('<span class="custom-parse-server-url">YOUR.PARSE-SERVER.HERE</span>', 443)
79-
params = urllib.urlencode({"username":"cooldude6","password":"p_n7!-e8"})
8079
connection.connect()
81-
connection.request('GET', '<span class="custom-parse-server-mount">/parse/</span>login?%s' % params, '', {
80+
connection.request('POST', '<span class="custom-parse-server-mount">/parse/</span>login', json.dumps({
81+
"username": "cooldude6",
82+
"password": "p_n7!-e8"
83+
}), {
8284
"X-Parse-Application-Id": "<span class="custom-parse-server-appid">${APPLICATION_ID}</span>",
8385
"X-Parse-REST-API-Key": "<span class="custom-parse-server-restapikey">${REST_API_KEY}</span>",
84-
"X-Parse-Revocable-Session": "1"
86+
"X-Parse-Revocable-Session": "1",
87+
"Content-Type": "application/json"
8588
})
8689
result = json.loads(connection.getresponse().read())
8790
print result

0 commit comments

Comments
 (0)