npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@redon2inc/strapi-plugin-refresh-token

v0.1.4

Published

Plugin for Strapi 5 to provide refresh token functionality.

Readme

Strapi Plugin that extends the local authorization functionality to provide Refresh tokens.

⚠️ Compatibility with Strapi versions

  • This plugin relies on Strapi5 new documentId. It will not work with earlier versions!
  • Works with local provider only.

⚙️ Installation

To install the Strapi Refresh Token Plugin, simply run one of the following command:

npm install @redon2inc/strapi-plugin-refresh-token
yarn add @redon2inc/strapi-plugin-refresh-token

Config

You will need to set the following environment variables:

 PRODUCTION_URL=value # used for cookie security if enabled
 REFRESH_JWT_SECRET=string 

This component relies on extending the user-permissions types. Extend it by adding the following to ./src/extensions/user-permissions/content-types/user/schema.json

// .. rest of schema
attributes:{
  // .. rest of attributes
  "refresh_tokens": {
      "type": "relation",
      "relation": "oneToMany",
      "target": "plugin::refresh-token.token",
      "mappedBy": "user",
      "private": true,
      "configurable": false
    }
}
// rest of code

Modify your plugins file config/plugin.ts to have the following:


  // ..other plugins
  'users-permissions': {
        config: {
          jwt: {
            /* the following  parameter will be used to generate:
             - regular tokens with username and password
             - refreshed tokens when using the refreshToken API
            */
            expiresIn: '2h', // This value should be lower than the refreshTokenExpiresIn below.
          },
        },
    },
  'refresh-token': {
    config: {
      refreshTokenExpiresIn: '30d', // this value should be higher than the jwt.expiresIn
      requestRefreshOnAll: false, // automatically send a refresh token in all login requests.
      refreshTokenSecret: env('REFRESH_JWT_SECRET') || 'SomethingSecret',
      cookieResponse: false, // if set to true, the refresh token will be sent in a cookie
      refreshTokenRotation: false, // forces a new Refresh token, deleting the previously used one from the db.
    },
  }

API Usage:

when calling POST:/api/auth/local include the requestRefresh parameter:

{
  "identifier":"username",
  "password":"VerySecurePassword",
  "requestRefresh": true
}

The API will respond with the following:

{
  "jwt":"token...",
  "user": { /* user object */ },
  "refreshToken": "RefreshToken..."
}

to request a new access token use the following: POST:/api/auth/local/refresh with the following payload:

{
  "refreshToken": "RefreshToken...",
}

if the Refresh token is valid, the API will return

{
  "jwt": "NewAccessToken..",
  "refreshToken": "NewRefreshToken..", // only if the config.refreshTokenRotation is set to TRUE
}

TODO:

  • Expose API so user can clear all sessions on their own.