Skip to content

a sample Chromium extension demonstrating how to integrate OIDC library, with a workaround for chromium manifest v3

Notifications You must be signed in to change notification settings

hjhill/OIDC-client-ts-chromium-sample

 
 

Repository files navigation

OIDC-client-ts - Chromium Extension Sample

This folder contains a sample Chromium extension demonstrating how to integrate OIDC library, with a workaround for chromium manifest v3.

key points:

  • runs inside the extension service worker (former background page). Inside the service worker it:
    • mocks global window object with JSDOM
    • mocks global localStorage and sessionStorage API and maps it synchronously to the chrome.storage API
    • exposes global function signIn() and signOut() and getSignedInUser()

Setup

  1. Create a new app registration in the Azure Portal.
  2. Provide your client ID in the PublicClientApplication configuration in auth.js.
  3. Under the Authentication tab, add a new redirect URI under Single-page application.
  4. The url of this redirect URI should be of the format https://<extension-id>.chromiumapp.org, e.g. https://epfnbngoodhmbeepjlcohfacgnbhbhah.chromiumapp.org/.
  5. You should also set this url as the Logout URL.
  6. Your extension ID can be found on the Extensions settings page after the extension has been loaded, or by invoking chrome.identity.getRedirectURL() in the extension.

Running the extension

  1. On the Extensions settings page, click the Load unpacked button, and select this folder.
  2. The extension will appear in the browser toolbar.
  3. Note: Because this extension relies on the chrome.identity APIs, it will not work in incognito/private browsing.
  4. The extension demonstrates how to login, acquire tokens, and logout using OIDC-client-ts library.

About

a sample Chromium extension demonstrating how to integrate OIDC library, with a workaround for chromium manifest v3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 91.1%
  • HTML 8.9%