Please try the following.
(1) Close all other apps you have open.
(2) Set your default browser to Google Chrome.
(3) Clear your browser's cache.
(4) Close all your browser's tabs.
(5) Access the below link using Google Chrome and try to log in.
https://accounts.nintendo.com
If you are able to log in, try logging in from the app again.
(6) Open Google Chrome's Settings menu, then tap Site settings, then set the below categories to the following settings.
Cookies: Allowed
JavaScript: Allowed
Pop-ups and redirects: Blocked
(7) Check the settings of the following apps or software if you are using them:
・Security software
・Memory cleaning tools
・Content blocker
・VPN
・Go to your device settings, tap Network and Internet, and turn off Data Saver.
(8) If you have security software installed, disable it only for when you link your Nintendo Account.
Note: The below steps can be skipped if you can't find Developer options in your device's Settings menu.
(9) If "Don't keep activities" is on under the Apps header in the Developer options menu, turn it off.
(10) If you have changed the "Background process limit" in the Developer options menu, disable it.