how can I login?
dsvb opened this issue · 4 comments
Hi,
I'm trying to create a login form in PHP.
I'm getting "Login error: ParseLibraryException: [0]:".
This is my complete code:
username = 'abc'; $parseLogin->password = 'pass'; try { $result = $parseLogin->login(); if ( $result ) { // success, set cookie echo 'Login successful'; } else { // display error echo 'Login error'; } } catch ( Exception $e ) { echo 'Login error: ' . $e; } ?>Any ideas on why this doesn't work?
I'm also getting two notices, screenshot follows.
I forgot to mention that I'm on WAMP.
I tried with LAMP too and I still get the login error exception.
you should use it like this :
try {
$result = $parseLogin->login();
} catch ( ParseLibraryException $e ) {
echo 'Login error: ' . $e->getMessage();
}
and then you will get a message which describe the error
and last thing you have you setup your config data
<?php
class parseConfig{
const APPID = '';
const MASTERKEY = '';
const RESTKEY = '';
const PARSEURL = 'https://api.parse.com/1/';
}
?>
I had this problem using XAMPP and solved it.
Inside parse.php
, I noticed that curl_exec($c);
was returning false
.
Adding print curl_error($c);
afterwards, I found that cURL was failing because of this error:
SSL certificate problem: unable to get local issuer certificate
I fixed this by downloading cacert.pem
from here - http://curl.haxx.se/docs/caextract.html - and adding this to the end of my php.ini
:
; cURL Root certificates
curl.cainfo=c:\xampp\php\ext\cacert.pem
Now everything's good.