Answer the question
In order to leave comments, you need to log in
Strange behavior of return $status/true code. In which direction to dig?
There is the following code:
$request= Request::createFromGlobals();
$token = $request->headers->get("Authorization");
$status = false;
$clientId = "xxx";
$secret = "yyy";
$secret = base64_decode(strtr($secret, '-_', '+/'));
try {
$decodedToken = \Firebase\JWT\JWT::decode($token, $secret, array('HS256'));
if ($decodedToken->aud === $clientId) {
$exp = $decodedToken->exp - time();
if ($exp >= 1) {
$status = true;
}
}
} catch (\Exception $e) {
$status = false;
}
return $status;
(Reason: CORS preflight channel failure).
Answer the question
In order to leave comments, you need to log in
Understood. My stupidity was. Further on the code was a redirect.
I don’t understand how this is related to using a variable, but if return $status(true) then it worked out the header location
, but only when using the variable there was an error.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question