in this blog we solve un authenticate user error in api, in this blog the error showing in android or ios app ,api not working properly, in app displayed Error user is unauthorized ,so now follow this code to solve error.
first clear cookies from your Browser.
now open your laravel project.
open the config file directory.
and open cors.php file.
Chenge the 'supports_credentials' => true,
5.now opne the sanctum.php file and check the gaurd name is same as in config.php file.
6.next spet to open session.php file and check 'expire_on_close' and 'encrypt'
if 'expire_on_close' => true, change in 'expire_on_close' => false,
and
if 'encrypt' => false, change in 'encrypt' => true,
7.finel step is opne the cPanel and change Your project PHP version like showing in image.