I have this problem with configuring login with Github on my discourse installation, after providing the necessary API keys required in the Admin > Settings > Login page in the github setup section.
Clicking on the Github login option redirects to a 404 page and returns the screenshot below.
and this in the URL bar https://MYDOMAIN/auth/oauth2_basic/callback?error=redirect_uri_mismatch&error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application.&error_uri=https%3A%2F%2Fdeveloper.github.com%2Fapps%2Fmanaging-oauth-apps%2Ftroubleshooting-authorization-request-errors%2F%23redirect-uri-mismatch&state=29b1f640d906a3bf4d92a1fe5846af740eea49adbfbfb65c
I did follow the guide and still couldn’t get it fixed, I eventually found a fix on my own.
Apparently the callback URL from the guide isn’t quite correct, I changed it from https://mydomain/auth/callback/githubtohttps://mydomain/auth/github and everything works well.
Perhaps the guide should be updated for future readers.