Github OAuth flow as a Firebase function (serverless function)
This is a Firebase Cloud Function for the Github OAuth web application flow - for enabling your users to authorize your Github OAuth App. Check this repo.
This is useful if you’re building an app without a back-end, or where your back-end is something you do not have complete control over (such as a CMS in a plugin development scenario).
I found Firebase useful for this case because I wanted access to all of the nice things Firebase offers, like Cloud Messaging (push notifications) and its Mongo-style database Firestore.
If you’re familiar with Firebase you’ll already know that it offers its own authentication system which includes Github auth - but this serverless function is for those who are not using the Firebase SDK in their front-end and just need the access token from Github 0Auth.