Code Monkey home page Code Monkey logo

passport-descope's Introduction

WordPress blue logo Strategy by Descope

License

Overview

This strategy is designed to help manage authentication and sessions in your express-based applications. This strategy authenticates users by validating the JWT in either Authorization Bearer or cookie, and provides additional user management features.

Getting started

Requirements

Installation

The Descope Passport strategy can be installed with npm.

npm i passport-descope

Using the Strategy

In order to utilize the authentication functions, you will need to initialize a DescopeStrategy object. You will need to define a retrieve your Descope Project ID and define a verify callback function to be able to authenticate using the DescopeStrategy object,

var DescopeStrategy = require('passport-descope');

passport.use(new DescopeStrategy({
  projectId: '<Your project ID>',
  managementKey: '<OPTIONAL management key>'
  verify: (jwtDetails, cb) => cb(null, {id: jwtDetails.token.sub})
}));

Required

  1. projectId - The project ID you can retrieve from the Descope Console here.

  2. verify - The verify function is specific to the passport-descope strategy, and the exact argument it receives (jwtDetails, cb) and the parameter it yields {id: jwtDetails.token.sub} is dependent on our Descope authentication strategy.

Optional

  1. managementKey - If you would like to also return user information as part of the verifyCallback function, you will need to include a Descope Management Key when you initialize your DescopeStrategy object. You can create one in the Company Settings portal here.

If you would like to learn more about Passport JS Strategies, please visit their website.

Code Samples

Feedback

Contributing

We appreciate feedback and contribution to this repository!

Raise an issue

To provide feedback or report a bug, please raise an issue on our issue tracker.

This project is licensed under the MIT license. See the LICENSE file for more info.

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.