npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

passport-daldalso

v1.1.4

Published

Daldalso authentication strategy for Passport

Downloads

44

Readme

Passport-Daldalso

  • Daldalso authentication strategy for Passport (OAuth 2.0)

npm

English

Install

$ npm install passport-daldalso

Usage

This module will provide the profile data you requested.

Refer to this article for profile data provided.

Create a Satellite (Daldalso OAuth 2.0 Application)

First of all, you must create a satellite.

Visit Daldalso OAuth Register Page and register your satellite.

Configure Strategy

let DaldalsoStrategy = require("passport-daldalso").Strategy;

passport.use(
  new DaldalsoStrategy(
    {
      clientID: config.daldalso.clientID,
      clientSecret: config.daldalso.clientSecret,
      callbackURL: config.daldalso.callbackURL,
    },
    function (accessToken, refreshToken, o, done) {
      User.findOne(
        {
          id: o.id,
        },
        function (err, user) {
          if (!user) {
            user = new User({
              key: o.key,
              name: o.name,
              provider: "daldalso",
              profile: o.profile,
            });
            user.save(function (err) {
              if (err) console.log(err);
              return done(err, user);
            });
          } else {
            return done(err, user);
          }
        }
      );
    }
  )
);

Authenticate Requests

Use passport.authenticate(), specifying the daldalso strategy, to authenticate requests.

For example, as route middleware in an Express application:

app.route("/login/daldalso").get(
  passport.authenticate("daldalso", {
    failureRedirect: config.daldalso.loginFail,
  }),
  users.signin
);

app.route("/login/daldalso/callback").get(
  passport.authenticate("daldalso", {
    failureRedirect: config.daldalso.loginFail,
  }),
  users.createAccount,
  users.authCallback
);

한국어

설치

$ npm install passport-daldalso

사용 안내

이 모듈은 요청된 프로필 정보를 달달소로부터 받아오고, 제공합니다.

이 문서 에서 제공되는 프로필 정보에 대해 더 자세히 알아볼 수 있습니다.

송수신체 등록하기 (달달소 OAuth 2.0 애플리케이션)

'달달소 계정으로 로그인' 기능을 구현하기 위해서는, 가장 먼저 송수신체를 등록해야 합니다.

달달소 송수신체 등록하기 에 접속하고 송수신체를 등록해주세요.

송수신체 등록 심사가 끝나면, 식별자와 고윳값을 받게 됩니다.

고윳값은 내 송수신체 목록 의 송수신체 클릭 후 상단 메뉴의 '고윳값 복사' 기능을 통해 복사할 수 있습니다.

Strategy 설정

let DaldalsoStrategy = require("passport-daldalso").Strategy;

passport.use(
  new DaldalsoStrategy(
    {
      clientID: config.daldalso.clientID,
      clientSecret: config.daldalso.clientSecret,
      callbackURL: config.daldalso.callbackURL,
    },
    function (accessToken, refreshToken, o, done) {
      User.findOne(
        {
          id: o.id,
        },
        function (err, user) {
          if (!user) {
            user = new User({
              key: o.key,
              name: o.name,
              provider: "daldalso",
              profile: o.profile,
            });
            user.save(function (err) {
              if (err) console.log(err);
              return done(err, user);
            });
          } else {
            return done(err, user);
          }
        }
      );
    }
  )
);

인증 요청

Express 애플리케이션의 라우트 미들웨어 예제입니다.

app.route("/login/daldalso").get(
  passport.authenticate("daldalso", {
    failureRedirect: config.daldalso.loginFail,
  }),
  users.signin
);

app.route("/login/daldalso/callback").get(
  passport.authenticate("daldalso", {
    failureRedirect: config.daldalso.loginFail,
  }),
  users.createAccount,
  users.authCallback
);

Special Thanks

Repository Referenced

License

MIT

ⓒ 2020-2021 이승훈