我正在尝试为名为 SonarQube(linting 工具)的应用程序设置 Bitbucket OAuth 使用者进行身份验证。按照指南,看起来我已经正确设置了所有内容 - https://github.com/SonarSource/sonar-auth-bitbucket。
回调 URL 设置为https://myserver/oauth2/callback。当我直接导航到它时,我得到“您无权访问此页面。请联系管理员。” - 这可能是有效的。我没有任何尾随斜杠或不正确的方案。
需要注意的一件事是我使用的是 nginx 反向代理。当标头 X-Forwarded-For 和 X-Forwarded-Proto 设置不正确时,我确实读过这个问题。请注意,我在这方面的故障排除技巧并不是最好的,但是当我使用开发工具并导航到https://myserver/oauth2/callback时,我没有看到这些标头设置。但是,当我运行时nginx -T | grep proxy_set_header
,它似乎是正确的。
root@01008bf897b1:/app# nginx -T | grep proxy_set_header
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
proxy_set_header Proxy "";
此外,当我在进行 Bitbucket 身份验证时查看 URL 时,我注意到它在 redirect_uri 中不包含 https:
如果我有 https,如下所示,它实际上会提示“确认访问您的帐户”:
我的反向代理设置是否不正确 - 代理标头?可能的 Bitbucket 问题?任何帮助,将不胜感激!