Git Product home page Git Product logo

passport-wechat's People

Contributors

dependabot[bot] avatar haocong avatar kenspirit avatar liangyali avatar loulin avatar nitzo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

passport-wechat's Issues

Update urllib to get rid of native-or-bluebird deprecation

When installing passport-wechat the following warning is produced:
npm WARN deprecated [email protected]: please use 'any-promise' instead

This is caused by [email protected] depending on [email protected]:
└─┬ [email protected]
├── [email protected]
├── [email protected]
└─┬ [email protected]
└─┬ [email protected]
├─┬ [email protected]
│ └── [email protected]
├── [email protected]
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └── [email protected]
├── [email protected]
└── [email protected]

[email protected] and up depend on the advertised replacement module any-promise

Unknown authentication strategy "wechat"

http://localhost:8080/passport/login/wechat

Error: Unknown authentication strategy "wechat"
at attempt (D:\kr_project\tmp\node_modules\passport\lib\middleware\authenticate.js:193:39)
at authenticate (D:\kr_project\tmp\node_modules\passport\lib\middleware\authenticate.js:379:7)
at Layer.handle [as handle_request] (D:\kr_project\tmp\node_modules\express\lib\router\layer.js:95:5)
at next (D:\kr_project\tmp\node_modules\express\lib\router\route.js:137:13)
at Route.dispatch (D:\kr_project\tmp\node_modules\express\lib\router\route.js:112:3)
at Layer.handle [as handle_request] (D:\kr_project\tmp\node_modules\express\lib\router\layer.js:95:5)
at D:\kr_project\tmp\node_modules\express\lib\router\index.js:281:22
at Function.process_params (D:\kr_project\tmp\node_modules\express\lib\router\index.js:335:12)
at next (D:\kr_project\tmp\node_modules\express\lib\router\index.js:275:10)
at Function.handle (D:\kr_project\tmp\node_modules\express\lib\router\index.js:174:3)

=======================

`/* login using wechat account */
router.get('/login/wechat', passport.authenticate('wechat'));

/* wechat callback url */
router.get('/oauth2/redirect/wechat',
passport.authenticate('wechat', { failureRedirect: '/?error=wechat_login_failed', failureMessage: true }),
function(req, res) {
console.log('login wechat account success');
res.redirect('/employeeMode');
});

app.js

// configure wechat passport login
var WechatStrategy = require('passport-wechat');
passport.use(new WechatStrategy({
appID: process.env['WECHAT_APP_ID'],
name: 'WeChat',
appSecret: process.env['WECHAT_APP_SECRET'],
client: 'web',
callbackURL: 'http://localhost:8080/passport/oauth2/redirect/wechat',
scope: 'snsapi_base',
state: '123'
// getToken: {getToken},
// saveToken: {saveToken}
},
function(accessToken, refreshToken, profile, done) {
var provider = 'wechat';
return passportHelper.passport_call_back(provider, profile, done, db);
}
));

`

支持loopback框架吗?

passport-wechat-public 中有提到说框架支持loopback-component-passport, 但是不知道该怎么用,可以给点提示吗?

这是我在providers里面的配置。

  "wechat-login": {
  "provider": "wechat",
  "module": "passport-wechat",
  "clientID": "wx0b1dd3ca76318a6b",
  "clientSecret": "b79a000339b2fe3d26205a5355819a84",
  "callbackURL": "/auth/wechat/callback",
  "authPath": "/auth/wechat",
  "callbackPath": "/auth/wechat/callback",
  "successRedirect": "/auth/account",
  "failureRedirect": "/login",
  "scope": ["snsapi_base"],
  "failureFlash": true
  },

Is it a false report for error 'passport.initialize() middleware not in use'

While I integrate feathers oauth2 with this passport-wechat, and visit http://localhost:3035/auth/wechat I got error 'passport.initialize() middleware not in use'.
I check this error is from line 56 in passport-wechat lib/strategy:

if (!req._passport) {
  return this.error(new Error('passport.initialize() middleware not in use'));
}

and why req._passport is undefined?

versions

"@feathersjs/authentication": "^2.1.7",
"@feathersjs/authentication-jwt": "^2.0.0",
"@feathersjs/authentication-local": "^1.1.0",
"@feathersjs/authentication-oauth2": "^1.2.4"
"passport-wechat": "^2.0.4"

Finally I found If I comment the above line, it can still work correctly. So is that a false report error?

在回调的时候总是error

我能够得到accessToken refreshToken 和 profile的值 使用 done(null , profile)总是 400 为什么呢
[Tue, 22 Dec 2015 06:34:53 GMT] "GET /api/user/auth/wechat" 302 2.512 ms 0
accessToken = OezXcEiiBSKSxW0eoylIePearzUkTO6p3rVb1p-rOuLbThz-b4NJ_F9rmlt9OTh8VdcY6WOSsawWxgD5F24Yx_ktwzsEcAyfCkIh_GEnw5Cw8GfLW9hPOC-NQ3sMkkVYlgAxSSg5LT5PsvsEnStDSw
refreshToken = OezXcEiiBSKSxW0eoylIePearzUkTO6p3rVb1p-rOuLbThz-b4NJ_F9rmlt9OTh8J4yZ2jOV_5NCO7iVscqOkxThtH7KUGPeduqnQMjDwS5ndJ7VmfD9B0Pv3wDSCSgqN-qZQSFlK8yDVUqEyEMQWQ
{ openid: 'on1lHxN-JI-eUE4F0Ha4p5x5p6ZE', unionid: undefined }

[Tue, 22 Dec 2015 06:37:08 GMT] "GET /api/user/auth/wechat/callback?code=011925dd48552cfcd02019b1df52528o&state=STATE" 400 170.527 ms 38

passport name

同时支持公众号登陆和网页登陆的时候会出现后一个覆盖前一个,建议给公众号登陆和网页登陆设置不一样的passport name

Scope 参数错误或没有Scope 权限

一直提示 Scope参数错误或没有Scope权限。

passport.use(new WechatStrategy({
  appID: app.get('wechat').appId,
  name: "wechat-login",
  appSecret: app.get('wechat').secret,
  client: "web",
  callbackURL: "http://127.0.0.1:3000/auth/wechat/callback",
  scope: "snsapi_base",
  state: "login"
},
  function (accessToken, refreshToken, profile, done) {
    console.log(accessToken);
    console.log(refreshToken);
    console.log(profile);
    done(err, profile)
  }
));


app.get('/auth/wechat', passport.authenticate("wechat-login", {
  state: "shit"
}));

app.get('/auth/wechat/callback', passport.authenticate('wechat-login', {
  failureRedirect: "/login",
  successReturnToOrRedirect: "/event/123"
}));

貌似没有支持 passport session?

我发现虽然在 express 中打开了 app.use(passport.session()),并且确认了 passport session 是工作的,但是每次session 工作成功之后,还是会在 passport-wechat 中被重定向到微信的认证页面。

是不是没有支持 passport session?

callbackURL is not in the latest NPM release

I need do dynamic Callback URL binding in Passport.Authenticate layer in my web app. The release version 2.0.2 in npm doesn't have your recent changes where callbackURL, state and scope could be overwritten. Could you consider releasing a new version with that feature?

Thanks!

传入配置时 appID 能否改为 clientID ?

在与其他项目整合时, 比如: https://github.com/feathersjs/authentication-oauth2

问题 1

他们使用的是 clientID 和 clientSecret:

app.configure(oauth2({
  name: 'facebook',
  Strategy: FacebookStrategy,
  clientID: '<your client id>',
  clientSecret: '<your client secret>',
  scope: ['public_profile', 'email']
}));

我们项目上用 appID, appSecret
这样命名上不一致在配置时可能出错, 是否可以考虑和他们统一?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.