Firebase provides great structure to create your own authentication system. However, the default providers list for external log-ins (oAuth2) is limited.
I'm a big fan of Discord and so here is a sample Firebase app that uses the Discord oAuth2 to create users in our Firebase Authentication and our Firestore database.
Please read the Disclaimer below if you have any issues.
If you need any help or assistance open an issue/pull request here on GitHub.
/api/login
and is redirected to Discord/api/auth
callback URIusers
collectionClient ID
and Client Secret
https://us-central1-<project-id>.cloudfunctions.net/api
https://us-central1-<project-id>.cloudfunctions.net/api/auth
Authentcation
tabDatabase
tab and enable Firestore Cloud
storage, more info on how to do this hereConfig
object. If you are unsure what to do, follow the steps linked here.info.js
folder inside the functions
folder and replace all information in there with the information you got from Discord/Firebase.firebasesrc
file and fill in your project name. Note: if you do not see this file you must enable the visibility of hidden files on your operating systemfunctions
folder and say npm install
to install al necessary packagesnpm install -g firebase-tools
firebase deploy
https://us-central1-<project-id>.cloudfunctions.net/api/login
to see it in actionAuthentication
TabIf you are getting errors because of your redirect URL, check that the URL listed in your Discord Developer Portal matches the URL of your project.