You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@forgerock/sdk-oidc

Package Overview
Dependencies
Maintainers
5
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@forgerock/sdk-oidc

A TypeScript library providing utilities for OpenID Connect (OIDC) authentication flows within Ping Identity's JavaScript SDK.

1.2.0
latest
Source
npmnpm
Version published
Maintainers
5
Created
Source

Ping Identity SDK OIDC Module

A TypeScript library providing utilities for OpenID Connect (OIDC) authentication flows within Ping Identity's JavaScript SDK.

Features

  • Create OIDC authorization URLs with proper PKCE implementation
  • Generate and manage state values for secure authentication
  • Support for various response types
  • Built with TypeScript for strong typing and better developer experience

Installation

npm install @forgerock/sdk-oidc

Usage

Creating an Authorization URL

import { createAuthorizeUrl } from '@forgerock/sdk-oidc';

async function initiateLogin() {
  const authUrl = await createAuthorizeUrl('https://auth.pingone.com/authorize', {
    clientId: 'your-client-id',
    redirectUri: 'https://your-app.com/callback',
    responseType: 'code',
    scope: 'openid profile email',
  });

  // Redirect the user to the authorization URL
  window.location.href = authUrl;
}

The createAuthorizeUrl function:

  • Generates a secure random state value
  • Creates a PKCE code verifier and challenge
  • Stores the state and verifier for later validation
  • Constructs a properly formatted authorization URL with all required parameters

API Reference

createAuthorizeUrl(authorizeUrl, options)

Creates an OIDC-compliant authorization URL for initiating the authentication flow.

Parameters:

  • authorizeUrl (string): The base authorization URL for the OIDC provider
  • options (object): Configuration options
    • clientId (string): The OAuth client ID
    • redirectUri (string): The URI to redirect to after authentication
    • responseType (string): The OAuth response type (typically 'code')
    • scope (string): Space-separated list of requested scopes

Returns:

  • Promise: A properly formatted authorization URL

Security Features

  • PKCE Implementation: Uses the PKCE (Proof Key for Code Exchange) extension to secure authorization code flow
  • State Parameter: Generates and validates state parameters to prevent CSRF attacks
  • Secure Storage: Securely stores PKCE verifiers and state values for validation

Building

Run nx build @forgerock/sdk-oidc to build the library.

Running Unit Tests

Run nx test @forgerock/sdk-oidc to execute the unit tests via Vitest.

FAQs

Package last updated on 26 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts