Skip to content

criipto/criipto-verify-passport-jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@criipto/verify-passport-jwt

A Passport strategy for authenticating with a Criipto Verify JWT. Based on jose.

Install

npm install @criipto/verify-passport-jwt

Usage

It is currently assumed that the token will be delivered via the Authorization: Bearer {token} header.

import CriiptoVerifyStrategy from '@criipto/verify-passport-jwt';

passport.use(
  'criiptoVerify',
  new CriiptoVerifyStrategy(
    {
      domain: '{YOUR_CRIIPTO_DOMAIN}',
      clientID: '{YOUR_CRIIPTO_APPLICATION_CLIENT_ID}'
    },
    async (jwtClaims) => {
      return User.findOne({id: jwtClaims.sub});
    }
  )
);

Authenticate requests

app.post('/', passport.authenticate('criiptoVerify', { session: false }), (req, res) => {
  res.json(req.user);
});

JWT Payload/Claims

You can find the expected JWT payload/claims contents in the e-ID section of the Criipto docs

Debugging

You can use DEBUG=@criipto/verify-passport-jwt to log errors from this library.

Criipto

Learn more about Criipto and sign up for your free developer account at criipto.com.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published