Series: Implementing OpenID with Node.js, TypeScript, and MongoDB - A Step-by-Step Guide

ebrahimmfadae

Ebrahim Hoseiny Fadae

Posted on February 17, 2022

Series: Implementing OpenID with Node.js, TypeScript, and MongoDB - A Step-by-Step Guide

Introduction

In this tutorial series, we will explore how to implement OpenID with Node.js, TypeScript, and MongoDB. The focus of this guide is to provide a comprehensive, step-by-step approach to building an OIDC (OpenID Connect 1.0) authorization server along with a web application and an API service. Through this tutorial we are going to use panava/node-oidc-provider library, which is an OpenID Certified™ OAuth 2.0 Authorization Server implementation for Node.js.

Source Code

You can find the complete source code for this tutorial series at ebrahimmfadae/openid-connect-app on GitHub.

Requirements

To follow along with this tutorial series, you should have a good understanding of JavaScript and be familiar with the concepts of OpenID or OAuth 2.0. Additionally, basic knowledge of CSS, HTML, TypeScript, and Docker will be beneficial.

Setup

Before getting started, ensure that you have the following versions installed:

$ node -v
v18.17.1

$ yarn -v
v3.6.3

$ docker --version
Docker version 20.10.7, build f0df350

$ docker-compose --version
Docker Compose version v2.15.1
Enter fullscreen mode Exit fullscreen mode

Goals

  • Create an authorization server based on OpenID protocol.
  • Create an web application that acts as a client for authorization server.
  • Create an API (resource server) to demonstrate accessing restricted resources by authenticated users.

USAGE WARNING!

Please note that the code provided in this tutorial series should not be used in production without ensuring proper security measures and suitability for your specific use case.

Ask for help or give feedback

If you need any assistance or have feedback to share, you can reach out to me through the following channels:

UPDATE #1 - 8 October 2022

Please note that the panava/node-oidc-provider repository has disabled its issue section, which raises concerns about the project's maintenance. Additionally, critical bugs have been observed that require delving into the source code for resolution. While the repository may still serve the purpose of learning the OIDC protocol, caution is advised when using it.

đź’– đź’Ş đź™… đźš©
ebrahimmfadae
Ebrahim Hoseiny Fadae

Posted on February 17, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related