Getting Started with OAuth2 Authentication

by 

| October 11, 2023 | in

Authentication is a big and scary topic in the world of software development, but it doesn’t have to be. OAuth with PKCE (Proof Key for Code Exchange) is easy to implement.

OAuth is short for “Open Authorization”. It is a common way to access data on the web. You often encounter OAuth when you sign in or sign up on a website and are redirected to another web page that looks close to the existing website.

Implementing OAuth isn’t difficult, but we like to make it seem that way. I have created a starter project you can use to start experimenting.

The process of getting signed in or signed up is pretty straightforward. We start with redirecting to a URL (authorize). The identity provider will authenticate a user (think user and password). The identity provider will redirect back to our web application.

In that redirect, the provider will give you a code query string parameter. We will use that code parameter to call another URL provided by the identity provider. We receive tokens from the identity provider by making a post to that URL. These tokens allow us to authenticate, or verify, the authentication of a user.

Authorization URL: <hostname>/oauth2/authorize

Token URL: <hostname>/oauth2/token

Below is the link to my sample project that will get you started quickly.

https://github.com/chadmichel/AuthStarter


Related posts