1.0.0 • Published 2 years ago

passport-kakao-oauth2 v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Passport-kakao

Kakao oauth2 passport login module.

Install

npm install passport-kakao-oauth2

How to use

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

passport.use(new KakaoStrategy({
    clientID : clientID,
    clientSecret: clientSecret,
    callbackURL : callbackURL
  },
  (accessToken, refreshToken, profile, done) => {
    User.findOrCreate(..., (err, user) => {
      if (err) { return done(err) }
      return done(null, user)
    })
  }
))

Profile information

You can get the following properties from the user profile.

keyvalueNote
providerStringkakao
idNumberUser kakao ID
_rawStringUser JSON stringified profile information
_jsonObjectUser JSON profile information

Sample

  1. Set "appKey" of ./sample/sample.js to you app key.
  2. Run the app and go to 127.0.0.1:3000/login in your browser.
cd ./sample
npm install
node app