GithubHelp home page GithubHelp logo

piruin / strapi-keycloak-provider-example Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 3.0 4 MB

[Example] adding your Keycloak as the authentication provider on Strapi

JavaScript 99.99% Shell 0.01%
example keycloak strapi

strapi-keycloak-provider-example's People

Contributors

dependabot[bot] avatar piruin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

strapi-keycloak-provider-example's Issues

JWT secret to decode bearer token

Hey @piruin you did a great job!

I have a question, I plan to use own RSA for keycloak private key & certificate.

I create a .env file that look like this, it need to use '\n` because .env file does not accept multiline string as variable

JWT_SECRET=-----BEGIN RSA PRIVATE KEY-----\n KEY-CONTENT-GOES-HERE \n-----END RSA PRIVATE KEY-----\n

I want the code to automatically change the \n to new line. I tried to use this line in jwt.js config to automatically parse the \n

jwtSecret: process.env.JWT_SECRET.replace(/\\n/g, '\n') || '02bb575a-bfa9-4c8c-aaca-33a752744fef'

But this line of code seems to always get the Private Key that has \n in it

verify(token) {
    return new Promise(function(resolve, reject) {
      jwt.verify(
        token,
        _.get(strapi.plugins, ['users-permissions', 'config', 'jwtSecret']),
        {},
        function(err, tokenPayload = {}) {
          if (err) {
            return reject(new Error('Invalid token.'));
          }
          resolve(tokenPayload);
        }
      );
    });
  }

Do you have any idea about this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.