@mvd/auth

Introduction

Browser-only OAuth 2.0 Authorization Code Flow with PKCE, with optional React hooks.

@mvd/auth

@mvd/auth is a browser-only OAuth 2.0 Authorization Code Flow with PKCE library.

It provides a core API from @mvd/auth and optional React hooks from @mvd/auth/react.

Scope

  • Starts the OAuth authorization flow with PKCE
  • Exchanges the authorization code for tokens
  • Stores auth state in browser storage
  • Refreshes tokens when a refresh token is available
  • Exposes React hooks for auth state
  • Decodes JWT access tokens into tokenData

Not included

  • OpenID Connect features such as id_token
  • UserInfo endpoint fetching
  • OIDC discovery
  • Server-side session handling

If your provider issues opaque access tokens, tokenData is not useful.

On this page