DEV Community

Afshar
Afshar

Posted on

2

OAuth 2

OAuth is an open standard to give access to somebody without using password on every request. It usually involves using tokens. OAuth is published in two versions, OAuth 1.0 on 2009 and OAuth 2.0 on 2013. OAuth is a service that is complementary to and distinct from OpenID. OAuth is an authorization protocol, rather than an authentication protocol. [1]

The requesting, granting, and life management of this token is often referred to as a “flow”. Private clients are typically applications with a backend that can keep a secret to use for authenticating. Public clients have no means of securely keeping a secret, for instance, a single page application that usually doesn’t have a backend. [2] Four basic flows are:

  1. Code Flow: for private clients, the server responds with a code.
  2. Implicit Flow: for public clients like SPAs, it is simpler and the server responds with an access token.
  3. Client Credentials Flow: designed for server-to-server, server responds with an access token, no refresh token exists here.
  4. Resource Owner Password Credentials Flow: password is entered to the client itself, very simple and designed for legacy and migration only

Code Flow includes these steps [3]:

  • Step 1 — Authorization Code Link
  • Step 2 — User Authorizes Application
  • Step 3 — Application Receives Authorization Code
  • Step 4 — Application Requests Access Token
  • Step 5 — Application Receives Access Token

The Proof Key for Code Exchange (PKCE) is an extension to the Code flow which allows it to be used over public clients.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️