Skip to content

Overview

The WSO2 Identity Server Browser SDK (@asgardeo/browser) adds authentication to single-page applications built with plain JavaScript or any framework that runs in the browser. It handles the OpenID Connect authorization code flow with PKCE, stores the session in the browser, and lets you call protected APIs with the user's access token.

Tip

If you build with React, Vue, Next.js or Nuxt, use the framework SDK instead. Each one is built on this SDK and adds components and hooks for that framework.

Installation

Use one of the following options to install the WSO2 Identity Server Browser SDK.

npm install @asgardeo/browser
yarn add @asgardeo/browser
pnpm add @asgardeo/browser

Getting started

Try out the WSO2 Identity Server JavaScript quickstart guide.

APIs

The SDK provides the following APIs.

AsgardeoSPAClient

AsgardeoSPAClient is the entry point of the SDK. Get an instance with AsgardeoSPAClient.getInstance(), configure it with initialize(), and use it to sign users in and out, read tokens and user information, and call protected APIs.

  • AsgardeoSPAClient – Methods for authentication, tokens, user information, HTTP requests and event hooks.
  • Configuration – The options that initialize() accepts.

Utilities

  • hasAuthParamsInUrl() – Returns true when the current URL carries an authorization code, which means WSO2 Identity Server has redirected the user back to your app after sign-in.

Guides