Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

oidc-client

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oidc-client

OpenID Connect (OIDC) & OAuth2 client library

  • 1.10.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
117K
decreased by-28.61%
Maintainers
1
Weekly downloads
 
Created

What is oidc-client?

The oidc-client npm package is a JavaScript library designed to handle OpenID Connect (OIDC) and OAuth2 protocols. It provides functionalities for user authentication, token management, and session handling in client-side applications.

What are oidc-client's main functionalities?

User Authentication

This feature allows you to authenticate users via OIDC. The code sample demonstrates how to configure the UserManager with the necessary parameters and initiate a sign-in redirect.

const oidc = new Oidc.UserManager({
  authority: 'https://example.com',
  client_id: 'client_id',
  redirect_uri: 'https://app.com/callback',
  response_type: 'id_token token',
  scope: 'openid profile api1'
});

oidc.signinRedirect();

Token Management

This feature handles token management, including retrieving the current user's tokens. The code sample shows how to get the current user and check if they are logged in.

oidc.getUser().then(function(user) {
  if (user) {
    console.log('User logged in', user);
  } else {
    console.log('User not logged in');
  }
});

Session Handling

This feature manages user sessions, including handling events when a user is loaded or unloaded. The code sample demonstrates how to add event listeners for user session events.

oidc.events.addUserLoaded(function(user) {
  console.log('User loaded', user);
});

oidc.events.addUserUnloaded(function() {
  console.log('User logged out');
});

Other packages similar to oidc-client

FAQs

Package last updated on 16 Dec 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc