• 技术交流
  • Flarum 使用Github和Google 谷歌 OAuth 2.0 服务登录

安装插件 FoF OAuth 官方: https://flarum.org/extension/fof/oauth

  • Allow users to log in with GitHub, Twitter, Facebook, Google, and more!
  • 安装插件命令 composer require fof/oauth

配置 Github 的 OAuth 2.0 服务登录第三方网站,参考图文教程

获得客户端ID和密钥,类似

Client ID: Ov23**************sxV
Client secrets: 0607
*********a074**********90c

配置 Google 谷歌 OAuth 2.0 服务登录第三方网站,参考图文教程

获得客户端ID和密钥,类似

客户端 ID: 660**************24.apps.googleusercontent.com
客户端密钥: GOCSPX-_
**************VWh

21 天 后

🐟️ Flarum 论坛社区 多域名 Google 谷歌 OAuth 2.0 服务登录 设置

/etc/nginx/conf.d/https.conf Nginxt 配置

server {
	listen 443 ssl http2;
	server_name www.你的域名.com bbs.你的域名.com vip.你的域名.com;
	
	ssl_certificate       cert/你的域名.com.pem;
	ssl_certificate_key   cert/你的域名.com.key;
	ssl_session_timeout 5m;
	ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
	ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:!aNULL:!MD5:!RC4:!DHE;
	ssl_prefer_server_ciphers on;

	root /var/www/flarum/public;
	client_max_body_size 8m;
	client_body_buffer_size 128k;
	index index.html index.php;

	include  /var/www/flarum/.nginx.conf;

	location ~ .*\.php(\/.*)*$ {
		include snippets/fastcgi-php.conf;
		fastcgi_pass unix:/run/php/php8.2-fpm.sock;
	}
}

/var/www/flarum/config.php 中 url 要改动一下

  "url" => "https://" . \Illuminate\Support\Arr::get($_SERVER, 'HTTP_HOST', '你的域名'),

现在多域名跨域成功,但是还有个问题 github 认证登录没支持多域名

  • google OAuth 2.0 客户端 ID 支持添加多域名,已经测试成功

长夜漫漫

捞鱼吧 论坛 目前支持多个域名访问 vip.lyvba.com www.lyvba.com bbs.lyvba.com

Flarum 论坛社区 多域名 OAuth 2.0 服务登录 暂时先只使用 Google 谷歌帐号登录