Weibo Login Plugin / 微博登录插件

It’s a oauth2 strategy for Sina Weibo.

https://github.com/fantasticfears/weibo-login

Authenticate with discourse with Weibo.

通过微博登陆 Discourse。

Register Client Key & Secert / 申请微博接入

  1. 登录微博开发者中心,注册填写相关信息。
  2. 点击开始接入
  3. 填写相关信息。网站域名可填写根域名或者具体域名。如图所示。(验证所需要的标签可在 Discourse 设置中插入,验证后即可删除;访问 Discourse 管理面板 - 内容 - 页面顶部)
  4. 在申请到的后台找到网站信息基本信息一栏,获得keysecret,将其填入Discourse 设置中。

Installation / 安装

Docker 安装

app.yml

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git

最后一行 - git clone https://github.com/discourse/docker_manager.git 后添加:

- git clone https://github.com/fantasticfears/weibo-login.git

Manual / 手动安装

Run rake plugin:install repo=https://github.com/fantasticfears/weibo-login in your discourse directory

In development mode, run rake assets:clean

In production, recompile your assets: rake assets:precompile

在您 Discourse 目录中运行 rake plugin:install repo=https://github.com/fantasticfears/weibo-login

在开发者模式下,运行 rake assets:clean

在生产模式下,重编译 assets rake assets:precompile

Usage / 使用

Go to Site Settings’s login category, fill in the client id and client secret.

进入站点设置的登录分类,填写 client id 和 client serect。

Issue / 问题

Visit topic on Discourse Meta or GitHub Issues.

访问Discourse Meta上的主题GitHub Issues

9 Likes

No,页面顶部加,是 js 插入的形式,微博检测不到,要选择 html 头部

另外,记得在微博高级设置里填写 回调地址

3 Likes

h后台管理处 还需要一个类似

的控制

1 Like

没有开启选项是因为这是一个插件。插件可以安装自然也可以禁用卸载,只是没有这样的明显的界面,应该是1.1的目标。

恩恩,要是有这样的功能就方便了呢。

另外我想说你的安装是不是少一步 ,比如

  ./laucher ssh app

执行后才能rake?

我对ruby 或者rails 没有任何经验


后来在app.yaml 添加github repo 就搞定了。

Don’t forget to restart rails server, so that the changes can apply.

./launcher stop app
./launcher start app

should do the work.

1 Like

@fantasticfears 请问如何能使登录自动读取邮箱(自动登录)?我在微博的API介绍里看到说要申请到SCOPE接口权限,除此之外还需要配置什么?谢谢!

还需要我测试一下 :frowning: 如果你申请到了高级 API,请联系我,我会改代码测试。这样你不需要做任何配置。

谢谢!我递交了申请,正在等待微博审核结果。

1 Like

谢谢你的插件哇!

话说可不可以吧这几个中国常用的sso都整合成一个plugin,然后在里边儿设toggle,这样安装管理起来就简单很多了~ :smile:

好建议。我会等待插件第三方库的依赖问题解决了之后这么试试的。