-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(passport): config passport-github behind of proxy #2318
Conversation
whyhow// {APP_ROOT}/config/config.{env}.js
// proxy
exports.proxy = true;
// passport
exports.passportGithub = {
key: process.env.EGG_PASSPORT_GITHUB_CLIENT_ID || 'test',
secret: process.env.EGG_PASSPORT_GITHUB_CLIENT_SECRET || 'test',
callbackURL: process.env.EGG_PASSPORT_GITHUB_CALLBACK_URL || '/passport/github/callback',
proxy: process.env.EGG_PROXY === 'proxy',
};
nginxdocker-compose.yml version: '3'
services:
proxy:
image: nginx:stable-alpine
ports:
- 80:80
- 443:443
volumes:
- ./ext/default.conf:/etc/nginx/conf.d/default.conf
- ~/.acme.sh/*.implements.io:/etc/nginx/ssl/ default.conf
备注:
|
secret: 'your_clientSecret' | ||
secret: 'your_clientSecret', | ||
// callbackURL: '/passport/github/callback', | ||
// proxy: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 proxy 是不是加错了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里还是得加:
config.proxy = true;
是正确设置utils.js
里app.get
是undefined
, 判断不了proxy
是否开启- 通过
egg-passport-github
的options
把 proxy 传给passport-oauth2
应该算 trick 了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
喔,我以为是下面说的 config.proxy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯嗯,这里是两个选项:
config.proxy = true
config.passportGithub.proxy = true
线上在跑了,应该没毛病
确实可以附加一个简化的 nginx 配置。 |
加在上面了,😀 |
Codecov Report
@@ Coverage Diff @@
## master #2318 +/- ##
=======================================
Coverage 99.59% 99.59%
=======================================
Files 29 29
Lines 749 749
=======================================
Hits 746 746
Misses 3 3 Continue to review full report at Codecov.
|
docs(passport): config passport-github behind of proxy (#2318)
Checklist
npm test
passesAffected core subsystem(s)
Description of change