Login not working on Firefox but works on google chrome please help

I tried to login to my nextcloud . at first it seemed login succeeded but then the page showed up saying Error . Then I took a look at the nextcloud.log and all I spotted was error shown below

Nextcloud version (eg, 20.0.5): 24.0.2.1
Operating system and version (eg, Ubuntu 20.04): 22.04
Apache or nginx version (eg, Apache 2.4.25): 2.4.29
PHP version (eg, 7.4): 8.1

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. open website.com/nextcloud
  2. try to login with creditantials
  3. get error page on firefox but works fine on chrome

The output of your nextcloud.log :

{"reqId":"YwPljGPMkTQAX8xIIQwGQAAAAAw","level":2,"time":"2022-08-22T20:22:36+00:00","remoteAddr":"192.168.1.35","user":"--","app":"core","method":"GET","url":"/nextcloud/index.php/js/core/merged-template-prepend.js?v=204ff47c-0","message":"Login failed: 'admin' (Remote IP: '192.168.1.35')","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0","version":"24.0.2.1"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'oce332sysxqpd',
  'passwordsalt' => 'RvVYrpLRslm39+4353t3t3r42452342',
  'secret' => 'dsfsffds+gi7XgigCEcjROzMrzH6s0MHMoVVN3vf7iCJu5p5R',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => 'true',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '192.168.1.22',
    'port' => 7001,
    'timeout' => 0.0,
    'password' => '',
    'dbindex' => 0,
  ),
  'trusted_domains' => 
  array (
    0 => '192.168.1.42',
    1 => 'website.com',
  ),
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'datadirectory' => '/media/storage/data',
  'dbtype' => 'mysql',
  'version' => '24.0.2.1',
  'overwrite.cli.url' => 'https://192.168.1.42/nextcloud',
  'dbname' => 'dbname',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'dbuser',
  'dbpassword' => 'somesecretpassword!',
  'installed' => true,
  'session_lifetime' => 86400,
  'session_keepalive' => true,
  'has_rebuilt_cache' => true,
  'updater.release.channel' => 'stable',
  'maintenance' => false,
);

when I attempt to login or even if I try to refresh I get the below page: