1.0.0 • Published 4 years ago
passport-kakao-oauth2 v1.0.0
Passport-kakao
Kakao oauth2 passport login module.
Install
npm install passport-kakao-oauth2How to use
- Register a web app on https://developers.kakao.com/
- Setup the strategy on your app
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.
| key | value | Note |
|---|---|---|
| provider | String | kakao |
| id | Number | User kakao ID |
| _raw | String | User JSON stringified profile information |
| _json | Object | User JSON profile information |
Sample
- Set "appKey" of
./sample/sample.jsto you app key. - Run the app and go to
127.0.0.1:3000/loginin your browser.
cd ./sample
npm install
node app1.0.0
4 years ago