The official document (https://developers.facebook.com/docs/facebook-login/login-flow-for-web) is the best tutorial. But when you follow it, there’s a few things you have to take notice.
First, you need to get your app id, if you don’t have it. You can create an app by visiting app dashboard (https://developers.facebook.com/apps/). Fill all the details but make sure you set it to “Website” by clicking “+ Add Platform”
Then, you will try your test code. Unfortunately, it will be likely to fail, as you didn’t set “App Domains” for your website. If you are smart enough to set it at the first time, then no problem.
The error message is like the above. So, you have to set app domains. You can set your production domain like “yourdomain.com” but you would also need to test it on your local dev machine. For me, I use host file (C:\Windows\System32\drivers\etc\hosts)
And add the test domain to your app settings in the app dashboard.
Then it’s done. It should log you successfully. If it doesn’t, please let me know.