# Weibo Login Plugin / Weibo Login Plugin

**URL:** <https://meta.discourse.org/t/weibo-login-plugin/19735>\
**Category:** Plugin\
**Tags:** broken\
**Created:** [September 7, 2014, 1:32am UTC](https://meta.discourse.org/t/weibo-login-plugin/19735 "2014-09-07T01:32:30Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)\
**Post date:** [September 7, 2014, 1:32am UTC](https://meta.discourse.org/t/weibo-login-plugin/19735/1 "2014-09-07T01:32:30Z")

</div>

It’s a oauth2 strategy for [Sina Weibo](http://weibo.com).

[https://github.com/fantasticfears/weibo-login](https://github.com/fantasticfears/weibo-login)

Authenticate with discourse with Weibo.

通过微博登陆 Discourse。

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

1. 登录[微博开发者中心](http://open.weibo.com/connect?bottomnav=1&wvr=5)，注册填写相关信息。
2. 点击`开始接入`。
3. 填写相关信息。`网站域名`可填写根域名或者具体域名。如图所示。（验证所需要的标签可在 Discourse 设置中插入，验证后即可删除；访问 Discourse 管理面板 - 内容 - 页面顶部）
4. 在申请到的后台找到`网站信息`的`基本信息`一栏，获得`key`和`secret`，将其填入Discourse 设置中。

 ![](https://global.discourse-cdn.com/meta/original/3X/6/2/628fedd738a4b47d54395c6e5e4e9217fb7088f9.png)

## 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](https://meta.discourse.org/t/weibo-login-plugin/19735) or [GitHub Issues](https://github.com/fantasticfears/weibo-login/issues).

访问[Discourse Meta上的主题](https://meta.discourse.org/t/weibo-login-plugin/19735)或[GitHub Issues](https://github.com/fantasticfears/weibo-login/issues)。

 ![](https://global.discourse-cdn.com/meta/original/3X/0/c/0c2c152761b90345ea8ee4b9f2ecd7c64ac78ca3.png)

 ![](https://global.discourse-cdn.com/meta/original/3X/a/e/ae74b476ae589439b7beeb41aa8a9e4799220830.png)

 ![](https://global.discourse-cdn.com/meta/original/3X/7/4/748c554714946bfc0240e8d33e3f18f9ca9a12a1.png)

---

<div class="post-metadata">

**Author:** ![coffin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/coffin/32/122440_2.png) [@coffin](https://meta.discourse.org/u/coffin)\
**Post date:** [September 25, 2014, 4:52pm UTC](https://meta.discourse.org/t/weibo-login-plugin/19735/6 "2014-09-25T16:52:23Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![longshun](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/longshun/32/34479_2.png) [@longshun](https://meta.discourse.org/u/longshun)\
**Post date:** [September 27, 2014, 3:05am UTC](https://meta.discourse.org/t/weibo-login-plugin/19735/7 "2014-09-27T03:05:09Z")

</div>

h后台管理处 还需要一个类似  
 ![](https://global.discourse-cdn.com/meta/original/3X/d/4/d468ea4822ac8c49d09676582b3d0c32fc156155.png)  
的控制

---

<div class="post-metadata">

**Author:** ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)\
**Post date:** [September 28, 2014, 7:01am UTC](https://meta.discourse.org/t/weibo-login-plugin/19735/8 "2014-09-28T07:01:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![longshun](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/longshun/32/34479_2.png) [@longshun](https://meta.discourse.org/u/longshun)\
**Post date:** [September 28, 2014, 8:24am UTC](https://meta.discourse.org/t/weibo-login-plugin/19735/9 "2014-09-28T08:24:21Z")

</div>

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

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

```
  ./laucher ssh app

```

执行后才能rake？

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

* * *

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

---

<div class="post-metadata">

**Author:** ![caogecym](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@caogecym](https://meta.discourse.org/u/caogecym)\
**Post date:** [October 23, 2014, 6:38am UTC](https://meta.discourse.org/t/weibo-login-plugin/19735/10 "2014-10-23T06:38:13Z")

</div>

> [@fantasticfears](#):
>
> In production, recompile your assets: rake assets:precompile

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

```
./launcher stop app
./launcher start app

```

should do the work.

---

<div class="post-metadata">

**Author:** ![katrim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/katrim/32/42345_2.png) [@katrim](https://meta.discourse.org/u/katrim)\
**Post date:** [June 8, 2015, 8:44pm UTC](https://meta.discourse.org/t/weibo-login-plugin/19735/13 "2015-06-08T20:44:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)\
**Post date:** [June 9, 2015, 1:39am UTC](https://meta.discourse.org/t/weibo-login-plugin/19735/14 "2015-06-09T01:39:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![katrim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/katrim/32/42345_2.png) [@katrim](https://meta.discourse.org/u/katrim)\
**Post date:** [June 10, 2015, 7:42pm UTC](https://meta.discourse.org/t/weibo-login-plugin/19735/15 "2015-06-10T19:42:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![preDawnHunter](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/predawnhunter/32/116445_2.png) [@preDawnHunter](https://meta.discourse.org/u/preDawnHunter)\
**Post date:** [July 21, 2015, 3:35am UTC](https://meta.discourse.org/t/weibo-login-plugin/19735/16 "2015-07-21T03:35:18Z")

</div>

谢谢你的插件哇！

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

---

<div class="post-metadata">

**Author:** ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)\
**Post date:** [July 21, 2015, 2:45pm UTC](https://meta.discourse.org/t/weibo-login-plugin/19735/17 "2015-07-21T14:45:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)\
**Post date:** [June 18, 2024, 3:52pm UTC](https://meta.discourse.org/t/weibo-login-plugin/19735/18 "2024-06-18T15:52:43Z")

</div>


