Douban Login Plugin / 豆瓣登录插件


(Erick Guan) #1

Douban is a Chinese SNS website allowing registered users to record information and create content related to film, books, music, and recent events and activities in Chinese cities.
Since Douban didn’t provide email, the user have to fill the email address manually.

Authenticate with discourse with Douban.

通过豆瓣登陆 Discourse。

Register Client Key & Secert / 申请豆瓣接入

  1. 登录豆瓣开发者中心,注册填写相关信息。
  2. 点击我的应用,再点击创建新应用
  3. 填写相关信息。网站域名可填写根域名或者具体域名。如图所示。(验证所需要的标签可在 Discourse 设置中插入,验证后即可删除;访问 Discourse 管理面板 - 内容 - 页面顶部)
    回调地址:
  • https 填写:http://meta.discoursecn.org:443/auth/douban/callback
  • http 填写:http://meta.discoursecn.org/auth/douban/callback
  1. 在申请到的后台找到刚申请到的引用,概览中即可以获得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/douban-login.git

Manual / 手动安装

Run rake plugin:install repo=https://github.com/fantasticfears/douban-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/douban-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


Login Strategy for Chinese Discourse / Discourse 登录插件列表
(Cobe) #2

做的真棒!

谢谢你的贡献!

正需要呢。
请问楼主 discourse 的代码在ubuntu的位置中是哪儿呢?


(Erick Guan) #3

你应该把那一段加到 containers/app.yml 里面。


(Cobe) #4

好的,谢谢楼主!

Sent from Mailbox


#5
  rm: cannot remove ‘/var/www/discourse/public/plugins/emoji’: Operation not permitted
ln: failed to create symbolic link ‘/var/www/discourse/public/plugins/emoji/public’: File exists
Cloning into '/var/www/discourse/plugins/douban-login'...
remote: Counting objects: 27, done.
remote: Total 27 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (27/27), done.
Checking connectivity... done.
warning: unable to access '/root/.config/git/attributes': Permission denied

try to install, but error shown above.


#29

This plugin does not working with newer Discourse.


(Erick Guan) #30

Works fine in 1.2.0.beta1. Would you mind posting your version?


#31

Sorry for late reply,
My version is : 1.2.0.beta2
tried reinstall plugin.


(Erick Guan) #32

Can you see the settings in the Login tab? Can you see the login option in the Create New Account?

Are you sure you added the git clone… into your configuration file?


#33

Thank you for update,
I finally figured it out myself.

i accidentally created duplicate folder


(Haobin Liang) #34

我的网站在登录豆瓣之后就转到个页面只显示下面的code

{"msg":"not_trial_user: 69207986","code":110,"request":"POST \/auth2\/auth"}

我的设置都没有问题的应该,回调地址用的 /auth/douban/callback。只是api还没审核,which我不知道该选哪个,豆瓣公共就够了?

Thanks.


(Erick Guan) #35

豆瓣公共足够了。如果是测试状态,你应该在豆瓣那增加测试用户。审核后似乎是正常的?见 https://meta.discoursecn.org 的登录