This shows an example of how you can implement Metamask authentication without any libraries.
This example is meant to provide information about how different Metamask libraries work under the hood. Implementing this on your own is totally possible but is normally not worth it unless you need 100% fine grained controls
It is easier to use a library such as Wen-connect