Ran composer update and composer bump on 13.09.2025 so I am up to date with everything.
I am using this small middleware for FE authorization.
public function handle(Request $request, Closure $next): Response
{
// When on mobile
if (System::isIos() || System::isAndroid()) {
$token = SecureStorage::get('auth_token');
if (!$token) {
return redirect()->route('login');
}
}
// When developing.
if (!Session::has('auth_token')) {
return redirect()->route('login');
}
return $next($request);
}
As I am not running actively the simulator and developing from browser I would expect the Session::has() to trigger, but instead I get System::isAndroid() = TRUE.
Added some debugging.
dd([
'isIos' => System::isIos(),
'isAndroid' => System::isAndroid(),
'secureStorageToken' => SecureStorage::get('auth_token'),
"config('nativephp-internal.platform') !== 'ios'" => config('nativephp-internal.platform'),
]);
Got the result back:
array:4 [▼ // app\Http\Middleware\HasSanctumToken.php:17
"isIos" => false
"isAndroid" => true
"secureStorageToken" => null
"config('nativephp-internal.platform') !== 'ios'" => null
]
Internally the isAndroid() does simple logic => config('nativephp-internal.platform') !== 'ios'
As the config value itself return NULL it passes and thinks we are on android.
This should not be the case.
Additions I would love to see.
System::isOnMobile();
SecureStorage:has('token');