method saveNewPermissionTokens documentation in bbn\User
function(string $access_token, string $refresh_token, int $expires_in, string $account_name)
{
if ($this->id) {
$account_exists = $this->db->count(
$this->class_cfg['tables']['permission_accounts'],
[
$this->class_cfg['arch']['permission_accounts']['id_user'] => $this->id,
$this->class_cfg['arch']['permission_accounts']['name'] => $account_name,
]
);
if ($account_exists > 0 ){
throw new Exception(X::_('Account already exists!'));
}
if ($this->db->insert(
$this->class_cfg['tables']['permission_accounts'], [
$this->class_cfg['arch']['permission_accounts']['id_user'] => $this->id,
$this->class_cfg['arch']['permission_accounts']['name'] => $account_name,
]
)) {
return (bool)$this->db->insert(
$this->class_cfg['tables']['permission_tokens'], [
$this->class_cfg['arch']['permission_tokens']['id_account'] => $this->db->lastId(),
$this->class_cfg['arch']['permission_tokens']['access_token'] => $access_token,
$this->class_cfg['arch']['permission_tokens']['refresh_token'] => $refresh_token,
$this->class_cfg['arch']['permission_tokens']['expire'] => time() + $expires_in,
]
);
}
}
return false;
}
BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions