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

@1000ship/passport-kakao

v1.0.0

Published

kakao oauth2 login module - Modified by 1000ship

Downloads

18

Readme

passport-kakao

kakao oauth2 로그인과 passport 모듈 연결체.

install

npm install passport-kakao

how to use

  • https://developers.kakao.com/ 에서 애플리케이션을 등록한다.
  • 방금 추가한 애플리케이션의 제품 설정 - 카카오 로그인에 들어가서 활성화 설정을 ON으로 한 뒤 저장한다.
  • 설정 - 일반에서, 플랫폼 추가를 누른 후 웹 플랫폼을 추가한다.
  • 웹 플랫폼 설정의 사이트 도메인에 자신의 사이트 도메인을 추가한다. (ex : http://localhost:3000)
  • 프로그램 상에서는 아래와 같이 사용한다.

clientSecret을 활성화 한 경우 해당 파라메터를 같이 넘겨줘야한다.

const passport = require('passport')
const KakaoStrategy = require('passport-kakao').Strategy

passport.use(new KakaoStrategy({
    clientID : clientID,
    clientSecret: clientSecret, // clientSecret을 사용하지 않는다면 넘기지 말거나 빈 스트링을 넘길 것
    callbackURL : callbackURL
  },
  (accessToken, refreshToken, profile, done) => {
    // 사용자의 정보는 profile에 들어있다.
    User.findOrCreate(..., (err, user) => {
      if (err) { return done(err) }
      return done(null, user)
    })
  }
))

기본 callbackPath는 /oauth 이고 https://developers.kakao.com 에서 수정할 수 있다. 하지만 callbackURL은 사이트 도메인/oauth 로 설정하는 것을 권장함. (ex : http://myhomepage.com:3000/oauth )

profile property

profile에는 아래의 property들이 설정되어 넘겨진다.

| key | value | 비고 | | -------- | ------ | ------------------------------------------ | | provider | String | kakao 고정 | | id | Number | 사용자의 kakao id | | _raw | String | 사용자 정보 조회로 얻어진 json string | | _json | Object | 사용자 정보 조회로 얻어진 json 원본 데이터 |

simple sample

설치 & 실행

  1. ./sample/server/app.tsappKey 를 https://developers.kakao.com 에서 발급받은 JS appKey 값으로 셋팅.
  2. command line 에서 아래의 커맨드 실행
  3. 브라우져를 열고 localhost:3000/login 을 입력 후 이후 과정을 진행한다.
cd ./sample/server
npm install
npm start

기타

passport-oauth 모듈과 passport-facebook 모듈을 참고함.