Browse Source

Improve CSRF handling

Maurits van der Schee 7 years ago
parent
commit
bdf13ab0c8
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      examples/client_auth.php

+ 2
- 2
examples/client_auth.php View File

@@ -24,8 +24,8 @@ function call($method, $url, $data = false) {
24 24
 }
25 25
 
26 26
 // in case you are using php-api-auth:
27
-$csrf = call('POST','http://localhost/blog.php/', 'username=admin&password=admin');
28
-$response = call('GET','http://localhost/blog.php/posts?include=categories,tags,comments&filter=id,eq,1&csrf='. trim($csrf));
27
+$csrf = json_decode(call('POST','http://localhost/api.php/', 'username=admin&password=admin'));
28
+$response = call('GET','http://localhost/api.php/posts?include=categories,tags,comments&filter=id,eq,1&csrf='. $csrf);
29 29
 
30 30
 unlink($cookiejar);
31 31
 

Loading…
Cancel
Save