Accessing JWT token from Providers.js

Hi, I have created a extended version of the Providers.js service getProfile function from the users and permissions plugin.

I need to retrieve the JWT token or read the cookie to expose the token, but in either case I need access to the ctx context, but this is not available directly.

I’m still new to Strapi, but I believe I can expose the ctx using a policy.

Can someone talk me through how I would do this, or how I can access the ctx.

In future, would it be possible to have the ctx object be a child of the strapi object, so that it is always available?


System Information
  • Strapi Version: 3.6.2
  • Operating System: Ubuntu 20.04.2 LTS
  • Database: sqlite3
  • Node Version: 14.15.3
  • NPM Version: 7.5.4
  • Yarn Version: 1.22.10