board
board copied to clipboard
[Help] Right way to generate access_token from cli?
require_once './server/php/config.inc.php';
require_once './server/php/libs/vendors/finediff.php';
require_once './server/php/libs/vendors/GoogleAuthenticator.php';
require_once './server/php/libs/core.php';
require_once './server/php/libs/vendors/OAuth2/Autoloader.php';
require_once './server/php/libs/ActivityHandler.php';
$j_username = $j_password = '';
require_once './server/php/bootstrap.php';
$_SERVER['REQUEST_METHOD'] = 'POST';
$post_val = [
'grant_type' => 'password',
'username' => 'admin',
'password' => 'vv',
'client_id' => OAUTH_CLIENTID,
'client_secret' => OAUTH_CLIENT_SECRET,
'scope' => 'read write',
];
$response = getToken($post_val);
$token = $response['access_token'];
I hacked together this code. Obviously I don't know password of the user, that's the point, I authenticated the user via other custom means already, now I want to log him in. Passing a random value in password works, but this token expires / becomes invalid after like 30min or so. Then restya board just renders as blank page. I have to clear cache then login page shows up. I guess server/php/shell/main.sh running from cron is invalidating this token.
I want this token to be valid indefinitely. How can I do that?