[#459] Issue related to login API

Migrated from Redmine #459 | Author: developer developer
Status: New | Priority: Immediate, there is BUG! | Created: 2019-12-24


I have used simple book login api and its not working on website. I have used below mentioned code for login.
$client = new JsonRpcClient(‘https://user-api.simplybook.me/’, array(
‘headers’ => array(
'X-Company-Login: '.‘magicmaid’,
'X-Token: ’ . $token
)
));

$getClient = $client->getClientInfoByLoginPassword($login,$password);

Please check and let me know solutions asap.

Dmytro Bondarev wrote:

Hi! Please provide RAW HTTP request

developer developer wrote:

Please check below http request

http://weburlforclients.com/gamma/hembry/login.php

Redmine Admin wrote:

hi, please provide us RAW http request as plain text here

developer developer wrote:

if(isset($_POST[‘submit’])){

$client = new JsonRpcClient(‘https://user-api.simplybook.me/’, array(
‘headers’ => array(
'X-Company-Login: '.‘magicmaid’,
'X-Token: ’ . $token
)
));

$getClient = $client->getClientInfoByLoginPassword($login,$password);

}

developer developer wrote:

if(isset($_POST[‘submit’])){
$loginClient = new JsonRpcClient(‘https://user-api.simplybook.me’ . ‘/login/’);
$token = $loginClient->getUserToken(‘magicmaid’, ‘Admin’, ‘Amazingdev1.’);

$client = new JsonRpcClient(‘https://user-api.simplybook.me/’, array(
‘headers’ => array(
'X-Company-Login: '.‘magicmaid’,
'X-Token: ’ . $token
)
));
$login = $_POST[‘email’];
$password = $_POST[‘password’];

$getClient = $client->getClientInfoByLoginPassword($login,$password);
}

developer developer wrote:

if(isset($_POST[‘submit’])){
$loginClient = new JsonRpcClient(‘https://user-api.simplybook.me’ . ‘/login/’);
$token = $loginClient->getUserToken(‘magicmaid’, ‘Admin’, ‘Amazingdev1.’);

$client = new JsonRpcClient(‘https://user-api.simplybook.me/’, array(
‘headers’ => array(
'X-Company-Login: '.‘magicmaid’,
'X-Token: ’ . $token
)
));
$login = $_POST[‘email’];
$password = $_POST[‘password’];

$getClient = $client->getClientInfoByLoginPassword($login,$password);
}

Redmine Admin wrote:

getClientInfoByLoginPassword ispublic API method but getUserToken is admin API method. Please check here API documentation | SimplyBook.me Online Scheduling
you need to use

var loginClient = new JSONRpcClient({
	'url': 'https://user-api.simplybook.me' + '/login',
	'onerror': function (error) {},
});
var token = loginClient.getToken(YOUR_COMPANY_LOGIN, YOUR_API_KEY);



this.client = new JSONRpcClient({
	'url': 'https://user-api.simplybook.me',
	'headers': {
		'X-Company-Login': YOUR_COMPANY_LOGIN,
		'X-Token': token
	},
	'onerror': function (error) {}
});



$loginClient = new JsonRpcClient('https://user-api.simplybook.me' . '/login/');
$token = $loginClient->getToken(YOUR_COMPANY_LOGIN, YOUR_API_KEY);


$client = new JsonRpcClient('https://user-api.simplybook.me' . '/', array(
    'headers' => array(
        'X-Company-Login: ' . YOUR_COMPANY_LOGIN,
        'X-Token: ' . $token
    )
));

developer developer wrote:

I have used below code but once again api is does’n works

<?php include_once ('JsonRpcClient.php'); if(isset($_POST['submit'])){ $loginClient = new JsonRpcClient('https://user-api.simplybook.me' . '/login/'); $token = $loginClient->getToken('magicmaid', '7f2e495c59e568c86fcb0c7f63bf1208eb66483203ec3b25c7148d8034099171'); $client = new JsonRpcClient('https://user-api.simplybook.me' . '/', array( 'headers' => array( 'X-Company-Login: '.'magicmaid', 'X-Token: ' . $token ) )); $login = $_POST['email']; $password = $_POST['password']; $getClient = $client->getClientInfoByLoginPassword($login,$password); } ?>

Redmine Admin wrote:

What is error?

(Short original content)

developer developer wrote:

500 error

(Short original content)

developer developer wrote:

developer developer wrote:

500 error

You can check the below url:-
http://weburlforclients.com/gamma/hembry/login.php

Dmytro Bondarev wrote:

please catch error from JsonRpcClient and check the error details.

@
try {
$getClient = $client->getClientInfoByLoginPassword($login,$password);
} catch (Exception $e) {
echo $e;
}
@
i have checked and it works fine on your company.

please make sure that you have changed API keys and credentials, because it is not safe to post them in such places.

developer developer wrote:

Okay let me check

(Short original content)

developer developer wrote:

I got the below error. Can you check the below problem

Exception: Request error: Client with given login/password not found in /home1/quirksto/public_html/gamma/hembry/JsonRpcClient.php:57 Stack trace: #0 /home1/quirksto/public_html/gamma/hembry/login.php(17): JsonRpcClient->__call(‘getClientInfoBy…’, Array) #1 {main}

Dmytro Bondarev wrote:

So there is no client with such login and password.
And API returns you error about it you should handle it and write to your customer that login or password is wrong.
There is nothing to check from our side.
Just enter correct login and password.

developer developer wrote:

That user is created by me from the API and the login details are correct.Also If I create user from the backend, I got the restore password link in email and this link is redirect to the page not found link.

Dmytro Bondarev wrote:

The client login custom feature was disabled in your account because your subscription has expired, so the link will not be available.

developer developer wrote:

Okay

(Short original content)

developer developer wrote:

Hello Dmitry,

Sorry for the delay. Now I have purchase the subscription till now the problem is not solved. Please check and let me know what issue. "Request error: Client with given login/password not found "