New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

passport-figma2

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-figma2

Figma OAuth Strategy for Passport

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-85%
Maintainers
1
Weekly downloads
 
Created
Source

passport-figma2

A passport strategy for Figma authentication. Has support for profile information compared to passport-figma.

Install

npm install passport-figma2

Usage of OAuth 2.0

var express        = require("express");
var session        = require('express-session');
var cookieParser   = require('cookie-parser');
var bodyParser     = require("body-parser");
var passport       = require("passport");
var FigmaStrategy = require('./lib/passport-figma').Strategy;

const app = express();

app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(session({
    secret: 'hello',
    resave: false,
    saveUninitialized: true
}));
app.use(passport.initialize());
app.use(passport.session());

passport.use(new FigmaStrategy({
    clientID: '<CLIENT_ID>',
    clientSecret: '<CLIENT_SECRET>',
    callbackURL: "http://localhost:3000/auth/figma/callback",
    scope: "file_read",
    response_type: 'code'
  }, function(accessToken, refreshToken, profile, done) {
    return done(null, profile);
  }
));

passport.serializeUser(function(user, done) {
    done(null, user);
});
 
passport.deserializeUser(function(user, done) {
    done(null, user);
});

app.get('/', (req, res) => {
    res.json(req.user);
});

app.get('/login', (req, res) => {
    res.json({message: 'You are not logged in!'})
})

app.get('/auth/figma', passport.authenticate('figma', {state: 'somestate'}));

app.get(
    '/auth/figma/callback', 
    passport.authenticate('figma', {failureRedirect: '/login'}), 
    (req, res) => {
        // Successful Request - Redirect home
        res.redirect('/');
    }
);

app.listen(3000);

Keywords

FAQs

Package last updated on 20 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc