function kakaoOAuth2() { var appId = keyConverter(process.env.KAKAO_RESTKEY); var secret = keyConverter(process.env.KAKAO_SECRETS); return new _oauth.OAuth2(appId, secret, "", "https://kauth.kakao.com/oauth/authorize", "https://kauth.kakao.com/oauth/token", null); }
// // daum // daumAuth(req, res) { // For eg. "http://localhost:3000/daum/callback" const params = { redirect_uri: makeRedirectUri(req, this.daumRedirectUri), response_type: "code" }; console.log("params", params); return res.redirect(this.daumOAuth2.getAuthorizeUrl(params)); }
const getOauth = () => { return new OAuth.OAuth( this.endPoint + api.requestTokenUrl, this.endPoint + api.accessTokenUrl, this.creds.consumerKey, this.creds.consumerSecret, '1.0', null, 'PLAINTEXT' ); }
app.get( '/auth', function(req, res) { oauth.getOAuthRequestToken(function(error, token, secret, results) { if ( error ) { res.send( 'error' ); return; } req.session.access = {}; req.session.token = token; req.session.secret = secret; res.redirect( `${service.url}/oauth1/authorize/?oauth_token=${token}` ); }); });
oauth.getOAuthRequestToken({},function(err, oauth_token, oauth_token_secret, results ){ if (!err) { self.requesttoken = {token: oauth_token, secret: oauth_token_secret, verifier: verifier}; self.setGearCacheValue('requesttoken',self.requesttoken); if (typeof(callback)=='function') callback(1); } else if (typeof(callback)=='function') callback(0); });
oauth2.getOAuthAccessToken( '', {'grant_type':'client_credentials'}, function (e, access_token, refresh_token, results){ console.log('bearer: ', access_token ); } );
///////////////////////////////////////////////////////// // login endpoint // ///////////////////////////////////////////////////////// router.post('/login', (req, res) => { req.session.redirect = req.body.origin || '/' const authURL = oauth2.getAuthorizeUrl({ redirect_uri: config.forge.oauth.redirectUri, scope: config.forge.oauth.scope.join(' ') }) res.json(authURL + '&response_type=code') })
// // facebook // facebookAuth(req, res) { // For eg. "http://localhost:3000/facebook/callback" const params = { redirect_uri: makeRedirectUri(req, this.fbRedirectUri), scope: "email,public_profile" }; console.log("params", params); return res.redirect(this.fbOAuth2.getAuthorizeUrl(params)); }
function fbOAuth2() { var appId = keyConverter(process.env.FB_APPIDS); var secret = keyConverter(process.env.FB_SECRETS); return new _oauth.OAuth2(appId, secret, "", "https://www.facebook.com/dialog/oauth", "https://graph.facebook.com/oauth/access_token", null); }
// // kakao // kakaoAuth(req, res) { // For eg. "http://localhost:3000/kakao/callback" const params = { redirect_uri: makeRedirectUri(req, this.kakaoRedirectUri), response_type: "code" }; console.log("params", params); return res.redirect(this.kakaoOAuth2.getAuthorizeUrl(params)); }
function naverOAuth2() { var appId = keyConverter(process.env.NAVER_APPIDS); var secret = keyConverter(process.env.NAVER_SECRETS); return new _oauth.OAuth2(appId, secret, "", "https://nid.naver.com/oauth2.0/authorize", "https://nid.naver.com/oauth2.0/token", null); }
// // naver // naverAuth(req, res) { // For eg. "http://localhost:3000/naver/callback" const params = { redirect_uri: makeRedirectUri(req, this.naverRedirectUri), response_type: "code" }; console.log("params", params); return res.redirect(this.naverOAuth2.getAuthorizeUrl(params)); }
function daumOAuth2() { var appId = keyConverter(process.env.DAUM_APPIDS); var secret = keyConverter(process.env.DAUM_SECRETS); return new _oauth.OAuth2(appId, secret, "", "https://apis.daum.net/oauth2/authorize", "https://apis.daum.net/oauth2/token", null); }
function instaOAuth2() { var appId = keyConverter(process.env.INSTA_APPIDS); var secret = keyConverter(process.env.INSTA_SECRETS); return new _oauth.OAuth2(appId, secret, "", "https://api.instagram.com/oauth/authorize/", "https://api.instagram.com/oauth/access_token", null); }
function googleOAuth2() { var appId = keyConverter(process.env.GOOGLE_APPIDS); var secret = keyConverter(process.env.GOOGLE_SECRETS); return new _oauth.OAuth2(appId, secret, "", "https://accounts.google.com/o/oauth2/v2/auth", "https://www.googleapis.com/oauth2/v4/token", null); }