Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@twilio-labs/docusaurus-plugin-refresh-session

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@twilio-labs/docusaurus-plugin-refresh-session

Handle expired auth tokens on protected Docusaurus sites.

next
latest
Source
npmnpm
Version
0.1.0-pre1
Version published
Maintainers
2
Created
Source

docusaurus-plugin-refresh-session

If you have a Docusaurus site that is protected by authentication, you need to handle specific errors that may happen on the client side when the authentication token expires. The client React SPA will try to fetch additional resources client-side when a user navigates to another page. If these resources fail to load due to an expired authentication token, we need to redirect the user to the login page so they can reauthenticate.

This has been tested with Docusaurus running on Netlify using netlify-okta-auth.

Installation

npm install --save @twilio-labs/docusaurus-plugin-refresh-session

Or, if you prefer Yarn:

yarn add @twilio-labs/docusaurus-plugin-refresh-session

Configuration

Accepted fields:

NameTypeDefaultDescription
redirectUrlstring""Url to redirect to when login expires.

If redirectUrl is left empty, it will just refresh the current page.

Example configuration

docusaurus.config.js

Use defaults:

  plugins: [
    "@twilio-labs/docusaurus-plugin-refresh-session",
  ],

Specify redirectUrl:

  plugins: [
    [
      "@twilio-labs/docusaurus-plugin-refresh-session",
      {
        redirectUrl: "https://example.com/login"
      },
    ],
  ],

Other features

If you are using Segment to track your site (perhaps using the docusaurus-plugin-segment package), this plugin will send an even to Segment whenever the session is refreshed.

If you aren't using Segment, nothing is tracked.

FAQs

Package last updated on 28 Jun 2022

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