passport-kakao-oauth2
v1.0.0
Published
kakao oauth2 login module
Downloads
1
Maintainers
Readme
Passport-kakao
Kakao oauth2 passport login module.
Install
npm install passport-kakao-oauth2
How 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.js
to you app key. - Run the app and go to
127.0.0.1:3000/login
in your browser.
cd ./sample
npm install
node app