配置第三方登录的站点是https://discourse.chandz.com
一、配置github登登录
1、在github注册一个新的应用
https://github.com/settings/developers
2、配置 GitHub获取Client ID和Client secrets
Application name:根据需求填写,本次填写为:discourse.chandz.com
Homepage URL:站点地址https://discourse.chandz.com
Authorization callback URL: 回掉地址路径是域名路径的/auth/github/callback
所以本次Authorization callback URL是https://discourse.chandz.com/auth/github/callback
3、配置discourse和github认证
github_client_id: 步骤2获取的github Client ID
github_client_secret:步骤2获取的github Client secrets
enable github logins:启用 Github 身份验证
二、配置Google OAuth2 登录(论坛所在机器无法访问google跳转会提示502)
1、在 https://console.developers.google.com创建一个新项目,获取Client ID和Client secrets,
步骤:
1>进入 https://console.developers.google.com 再左上方单击 选择一个项目(Select a project)
2>输入项目信息在 项目名称(Project Name) 字段中输入项目的名称点击创建
3>提交校验
点击project选择External创建项目
4>配置项目信息
配置App name、User support email、Application home page、Authorized domain和Developer contact information
4>创建Credentials
5>应用类型配置
选择 Application Type 的授权类型为Web application 。
在 Authorized JavaScript Origins 界面中,添加你的网站 URL,需要注意的是这个网站的 URL 需要以 http:// 或者 https:// 开头。在 Authorized Redirect URI 部分,需要在你前面输入的 URL 后面添加 /auth/google_oauth2/callback
6>通过上述操作在 OAuth 客户端对话框中将会显示 client ID 和 secret2、discourse配置
在discourse 配置中,单击 enable google oauth2 logins,然后输入你在上面的步骤中获得的 google oauth2 client id 和 google auth2 client secret。
并且将上面的秘钥对输入到正确的配置对话框中。至此,针对 Google 的登录配置应该配置完成了
三、discourse配置微信登录
1、注册微信开放平台账号