I need to make a login system than uses FIDO tokens, I heard than chrome supports u2f natively since version 40. But I am currently usin chrome 89 and I see than window.u2f is undefined.
In firefox u2f variable is defined natively
There are demo applications than use FIDO tokens (such as https://demo.yubico.com/webauthn-technical/registration and https://devise-fido-u2f.herokuapp.com/), this applications work correctly in Chrome browser, but I haven been able to figure out how do they do that.
What is the correct way to use u2f singing in Google Chrome?
U2F only works on HTTPS webpages and you likely want to use the newer and more widely supported WebAuthn standard and related APIs (as does the Yubico demo application).
The Rails demo version you linked uses the u2f-api.js API to monkey patch in missing support.