如果我转储$login
变量,则会在对象中获得所有4个令牌:
{#719 ▼
+"initial_access": "...token..."
+"refresh_token": "...token..."
+"ui_access": "...token..."
+"auth_access": "...token..."
}
但是我无法循环播放它们,甚至在逐个转储每个文件时遇到问题。
如果我一个接一个地注释掉4条解码线,分别转储它们,则interfaceResult和initialResult似乎将转储解码的值。但是,$refreshResult
给我错误的段数错误,$authResult
说不允许算法?
是否有更好的方法可以解决这个问题,以便我可以解码和缓存所有4个令牌?
//Rest call to get tokens returned
$login = $authService->loginGetToken($email, $password);
//This dumps the whole object with all 4 encoded tokens
//dd($login)
//public key for JWT
$key = "publicKey";
$initial = $login->initial_access;
$refresh = $login->refresh_token;
$interface = $login->ui_access;
$auth = $login->auth_access;
$initialResult = JWT::decode($initial, $key, array('HS256'));
$refreshResult = JWT::decode($refresh, $key, array('HS256'));
$interfaceResult = JWT::decode($interface, $key, array('HS256'));
$authResult = JWT::decode($auth, $key, array('HS256'));
//dd($initialResult);
//dd($refreshResult);
//dd($interfaceResult);
//dd($authResult);